Skip to content

Release #2012

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 204 commits into from
Aug 2, 2025
Merged

Release #2012

merged 204 commits into from
Aug 2, 2025

Conversation

jaybuidl
Copy link
Member

@jaybuidl jaybuidl commented May 28, 2025

Contract changes

V0.11.0
V0.10.0


PR-Codex overview

This PR focuses on enhancing the dispute resolution system by introducing new components and updating existing ones, particularly around the Shutter dispute kit, along with various improvements in the codebase for better functionality and maintainability.

Detailed summary

  • Deleted AllCasesButton component.
  • Introduced SeeAllCasesButton and SeeAllJurorsButton components.
  • Updated JustificationArea import paths.
  • Enhanced dispute-related components with new props and functionality.
  • Added disputeKit to the StakingResult enum.
  • Updated environment variables to include REACT_APP_SHUTTER_API.
  • Improved error handling in hooks and queries.
  • Adjusted various components to use the new disputeKit structure.
  • Updated package versions in package.json files.
  • Refactored function signatures to include new parameters for dispute handling.
  • Enhanced UI components for better responsiveness and user experience.
  • Added new contracts for DisputeKitGatedShutterProxy and DisputeKitShutterProxy.
  • Cleaned up unused code and comments across multiple files.

The following files were skipped due to too many changes: web/src/pages/Profile/index.tsx, subgraph/core/abi-migrations/KlerosCore.json, web/src/assets/svgs/icons/gavel-executed.svg, contracts/test/arbitration/draw.ts, web/src/pages/Cases/CaseDetails/Voting/index.tsx, subgraph/core/subgraph.yaml, web/src/pages/Cases/CaseDetails/Voting/Shutter/Reveal.tsx, subgraph/scripts/update.sh, web/src/components/DisputePreview/DisputeContext.tsx, web/src/components/EvidenceCard.tsx, subgraph/core/tests/sortition-module-utils.ts, web/src/components/Verdict/FinalDecision.tsx, contracts/test/arbitration/index.ts, subgraph/core-neo/abi-migrations/SortitionModuleNeo.json, contracts/src/arbitration/dispute-kits/DisputeKitShutter.sol, web/src/pages/Cases/CaseDetails/Voting/Shutter/Commit.tsx, contracts/src/arbitration/dispute-kits/DisputeKitGated.sol, web/src/pages/Cases/CaseDetails/Appeal/Shutter/Fund.tsx, subgraph/core/abi-migrations/SortitionModule.json, subgraph/core-university/subgraph.template.yaml, web/src/utils/shutter.ts, subgraph/core/src/DisputeKitClassic.ts, yarn.lock, subgraph/core-neo/subgraph.template.yaml, web/src/components/Verdict/DisputeTimeline.tsx, subgraph/core/subgraph.template.yaml, contracts/src/arbitration/dispute-kits/DisputeKitGatedShutter.sol, contracts/src/arbitration/KlerosCoreBase.sol, contracts/scripts/shutter.ts, contracts/scripts/keeperBotShutter.ts, contracts/src/arbitration/university/KlerosCoreUniversity.sol, contracts/test/arbitration/dispute-kit-gated.ts, contracts/src/arbitration/dispute-kits/DisputeKitClassicBase.sol, contracts/src/arbitration/university/SortitionModuleUniversity.sol, contracts/scripts/keeperBot.ts, contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter_Proxy.json, contracts/test/arbitration/staking.ts, contracts/test/arbitration/staking-neo.ts, contracts/src/arbitration/SortitionModuleBase.sol, contracts/test/foundry/KlerosCore.t.sol, contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter.json, contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter_Implementation.json

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

Summary by CodeRabbit

  • New Features

    • Added "See All" buttons for cases and jurors for easier navigation.
    • Introduced new contract functions exposing detailed dispute and court info.
    • Enabled jurors to withdraw leftover PNK tokens after fully unstaking.
    • Added Shutter dispute kit supporting encrypted vote commit and reveal.
    • Launched appeal crowdfunding UI and logic for Shutter dispute kit.
    • Added Shutter vote commit and reveal components with encryption integration.
    • Added new dispute kits with token gating and shielded voting capabilities.
    • Added ERC1155 test token contract and deployment support.
    • Added scripts for Shutter vote auto-reveal and encryption/decryption utilities.
    • Added new proxy contracts for DisputeKitGatedShutter and DisputeKitShutter.
    • Added new Bash script to analyze initializer versions across multiple networks.
    • Added new subgraph manifests for Core Neo and University versions.
    • Added dynamic dispute kit ID handling in subgraph for multi-kit support.
    • Added support for multiple dispute kits in keeper bot and subgraph.
    • Added new React components and hooks for Shutter voting commit and reveal phases.
  • Improvements

    • Enhanced layout and alignment in "Latest Cases" and "Top Jurors" sections.
    • Improved appeal countdown wording for clarity.
    • Added color styling for loading states in document viewer.
    • Added pre-check to avoid unnecessary juror draw attempts.
    • Context-sensitive navigation in attachment headers.
    • URLs for policy and evidence links now include dispute IDs.
    • Enhanced dispute context and labeling components.
    • Streamlined timeline and verdict components.
    • Added thousands separators in numeric displays.
    • Centralized user case statistics calculation.
    • Introduced filter sanitization utility for queries.
    • Improved accuracy in dispute event identification.
    • Separated stake validation and state updates in staking contracts.
    • Simplified delayed stake handling and unified related events.
    • Improved penalty accounting and juror inactivity handling.
    • Strengthened access control on stake-related functions.
    • Enhanced dispute lifecycle state management on appeal decisions.
    • Improved shutdown handling and logging in keeper bot.
    • Integrated Shutter API for vote encryption and decryption.
    • Added Vite plugin to copy Shutter SDK static files.
    • Added environment variables for Shutter API endpoint across environments.
    • Improved popup components to support automatic vote reveal messaging.
    • Refined staking and delayed stake event handling in tests.
    • Updated contract initialization routines and versioning.
    • Simplified and unified event handlers in subgraph and test utilities.
    • Enhanced dispute kit event handling with dynamic dispute kit IDs.
    • Improved contract deployment scripts with new dispute kits.
    • Improved staking logic with explicit leftover PNK withdrawal functions.
    • Added support for DisputeKitShutter in contract utilities.
    • Added new environment variable declarations for Shutter API in multiple environments.
    • Upgraded Node.js and devDependencies versions in contracts package.
    • Updated Yarn version in package configuration.
  • Bug Fixes

    • Added active-state checks to prevent operations on inactive disputes.
    • Corrected court ID boundary checks and error handling in staking logic.
    • Fixed staking and delayed stake event emissions and token balance assertions in tests.
    • Fixed event signature and parameter mismatches in subgraph and contracts.
    • Corrected vote casting logic for multiple dispute kits.
  • Chores

    • Updated documentation and package versions.
    • Removed unused components and redundant code.
    • Consolidated event handlers and test utilities for simpler maintenance.
    • Added deployment and upgrade scripts for new dispute kits.

jaybuidl and others added 30 commits April 24, 2025 18:06
…ata sources not deployed

e.g. DisputeKitShutter on testnet
…ple-dispute-kit-above-id-1

feat: subgraph support for shutter disputekit in devnet
@jaybuidl jaybuidl marked this pull request as ready for review August 2, 2025 03:53
@jaybuidl jaybuidl requested review from a team as code owners August 2, 2025 03:53
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: 6

🔭 Outside diff range comments (2)
contracts/deployments/arbitrumSepolia/KlerosCore.json (1)

1666-1679: Fix the wrapped-native token address in Arbitrum-Sepolia deployment

Our sanity check shows the _wNative argument in contracts/deployments/arbitrumSepolia/KlerosCore.json is incorrect:

  • Current value (.execute.args[0]):
    0xAEE953CC26DbDeA52beBE3F97f281981f2B9d511
  • Canonical Arbitrum-Sepolia WETH9:
    0x8Aa68E18D7Fb913F4Fd79E12F1e7E5727E6dB112

Using the wrong address will break fee routing. Please update the _wNative parameter passed to initialize:

--- a/contracts/deployments/arbitrumSepolia/KlerosCore.json
+++ b/contracts/deployments/arbitrumSepolia/KlerosCore.json
@@ -1666,7 +1666,7 @@
         {
           "internalType": "address",
           "name": "_wNative",
-          "type": "address", "value": "0xAEE953CC26DbDeA52beBE3F97f281981f2B9d511"
+          "type": "address", "value": "0x8Aa68E18D7Fb913F4Fd79E12F1e7E5727E6dB112"
         }
contracts/deployments/arbitrum/SortitionModuleNeo.json (1)

128-141: Inconsistent _courtID type across staking events.

StakeDelayed emits _courtID as uint96, while StakeSet still uses uint256.
This breaks type consistency for off-chain indexers (subgraph, bots) that expect a uniform ABI.

-event StakeSet(address indexed _address, uint256 _courtID, …);
+event StakeSet(address indexed _address, uint96 indexed _courtID, …);

Align both events to uint96 (the type used in storage) and, ideally, mark the parameter indexed for easier filtering.

Also applies to: 170-183

🧹 Nitpick comments (13)
contracts/deployments/arbitrumSepolia/DisputeKitClassic.json (2)

787-804: Parameter naming mismatch may confuse integrators

getNumberOfRounds(uint256 _localDisputeID) takes a local ID, unlike most view helpers that take _coreDisputeID.
Add NatSpec to the contract—or at least an inline comment—to avoid accidental misuse.


1086-1098: Expose wNative() only when non-zero

Front-end and subgraph code should treat a zero address as unset and fall back to native token logic to avoid accidental transfers to address(0).

contracts/CHANGELOG.md (5)

5-5: Reference spec name is incorrect
The de-facto standard is “Keep a Changelog”, not “Common Changelog”.

-The format is based on [Common Changelog](https://common-changelog.org/).
+The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

20-20: Awkward phrasing
“a more number of iterations” reads oddly. Simplify to “more iterations”.

-Draw jurors with a more number of iterations to account for ineligible jurors by the keeper bot
+Draw jurors with more iterations to handle ineligible jurors (keeper bot)

37-42: Inconsistent “Breaking” bullet formatting
Some bullets use **Breaking:**, others **Breaking**:. Pick one style (the first is more common).

- **Breaking**: Make `KlerosCoreBase.draw()` return the number of drawn jurors
+ **Breaking:** Make `KlerosCoreBase.draw()` return the number of drawn jurors

(Apply the same fix to Lines 40-42 for consistency.)


50-52: Grammar – missing preposition
Insert “for” and tighten wording.

-Add Gated dispute kit with support a dynamic token address for the Gated dispute kit using the dispute `extraData`
+Add Gated dispute kit that supports a dynamic token address via dispute `extraData`

60-61: Grammar – wrong preposition
Should be “remove … from”, not “to”.

-Remove the parameter `_alreadyTransferred` to the staking functions.
+Remove the `_alreadyTransferred` parameter from the staking functions.
.gitignore (1)

208-209: Double-check the contents of .env.project and .env.vault

These two files are now forced back into version control. If they contain real secrets rather than redacted placeholders, consider keeping only scrubbed templates here and loading actual secrets from a secure store in CI/CD.

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

916-944: On-chain hashVote may be mis-used
Because it accepts a full justification string, calling it on-chain costs unnecessary gas. The intended pattern is to compute the hash client-side. Consider adding a NatSpec note or renaming to hashVoteOffchain to discourage accidental on-chain calls.

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

598-603: initialize4 adds another initializer without deprecating the previous ones.

Multiple public initializers increase the surface for mis-configuration. Consider:

  1. Renaming the new initializer to initialize and gating it with reinitializer(4), or
  2. Explicitly disabling the earlier initialize* functions after upgrading.

This prevents accidental calls on an already-initialized proxy.

contracts/deployments/arbitrumSepoliaDevnet/DisputeKitClassic.json (3)

486-504: Public mapping accessor may leak unnecessary data & incur gas

coreDisputeIDToActive(uint256) → bool is now externally callable.
Consider marking it internal + exposing a dedicated getter that reverts on unknown IDs to spare 2,100 gas per call and avoid letting crawlers poll random IDs.


787-804: getNumberOfRounds() – clarify whether return is 0- or 1-based

Docs and UI counters must agree; otherwise the last round may be skipped in pagination.


916-944: On-chain hashVote() duplicates off-chain logic

Because it’s a pure function, all consumers can (and should) hash locally to save ~25k gas per call.
Unless audit requirements mandate an on-chain reference, you could drop this to slim the byte-code.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6786c29 and 8dc21bc.

📒 Files selected for processing (26)
  • .dockerignore (1 hunks)
  • .github/workflows/contracts-testing.yml (1 hunks)
  • .gitignore (1 hunks)
  • contracts/.solcover.js (1 hunks)
  • contracts/CHANGELOG.md (1 hunks)
  • contracts/README.md (5 hunks)
  • contracts/deploy/00-home-chain-arbitration-neo.ts (4 hunks)
  • contracts/deploy/upgrade-all.ts (2 hunks)
  • contracts/deployments/arbitrum/DisputeKitClassicNeo.json (7 hunks)
  • contracts/deployments/arbitrum/DisputeKitGatedNeo.json (1 hunks)
  • contracts/deployments/arbitrum/DisputeKitGatedNeo_Proxy.json (1 hunks)
  • contracts/deployments/arbitrum/DisputeKitGatedShutterNeo.json (1 hunks)
  • contracts/deployments/arbitrum/DisputeKitGatedShutterNeo_Proxy.json (1 hunks)
  • contracts/deployments/arbitrum/DisputeKitShutterNeo.json (1 hunks)
  • contracts/deployments/arbitrum/DisputeKitShutterNeo_Proxy.json (1 hunks)
  • contracts/deployments/arbitrum/KlerosCoreNeo.json (6 hunks)
  • contracts/deployments/arbitrum/SortitionModuleNeo.json (11 hunks)
  • contracts/deployments/arbitrumSepolia/DisputeKitClassic.json (7 hunks)
  • contracts/deployments/arbitrumSepolia/DisputeKitGated.json (1 hunks)
  • contracts/deployments/arbitrumSepolia/DisputeKitGatedShutter.json (1 hunks)
  • contracts/deployments/arbitrumSepolia/DisputeKitShutter.json (1 hunks)
  • contracts/deployments/arbitrumSepolia/KlerosCore.json (6 hunks)
  • contracts/deployments/arbitrumSepoliaDevnet/DisputeKitClassic.json (9 hunks)
  • contracts/deployments/arbitrumSepoliaDevnet/DisputeKitGated.json (1 hunks)
  • contracts/deployments/arbitrumSepoliaDevnet/DisputeKitGatedShutter.json (1 hunks)
  • contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter.json (1 hunks)
✅ Files skipped from review due to trivial changes (9)
  • .github/workflows/contracts-testing.yml
  • .dockerignore
  • contracts/.solcover.js
  • contracts/deployments/arbitrum/DisputeKitShutterNeo_Proxy.json
  • contracts/deployments/arbitrum/DisputeKitGatedShutterNeo_Proxy.json
  • contracts/deployments/arbitrum/DisputeKitGatedNeo_Proxy.json
  • contracts/deployments/arbitrum/DisputeKitGatedShutterNeo.json
  • contracts/deployments/arbitrum/DisputeKitShutterNeo.json
  • contracts/deployments/arbitrum/DisputeKitGatedNeo.json
🚧 Files skipped from review as they are similar to previous changes (7)
  • contracts/deploy/upgrade-all.ts
  • contracts/README.md
  • contracts/deployments/arbitrumSepolia/DisputeKitGated.json
  • contracts/deployments/arbitrumSepolia/DisputeKitGatedShutter.json
  • contracts/deployments/arbitrumSepoliaDevnet/DisputeKitShutter.json
  • contracts/deployments/arbitrumSepoliaDevnet/DisputeKitGatedShutter.json
  • contracts/deployments/arbitrumSepolia/DisputeKitShutter.json
🧰 Additional context used
🧠 Learnings (15)
📓 Common learnings
Learnt from: jaybuidl
PR: kleros/kleros-v2#1746
File: contracts/config/courts.v2.mainnet-neo.json:3-5
Timestamp: 2024-11-19T17:18:39.007Z
Learning: In `contracts/config/courts.v2.mainnet-neo.json`, the General Court (id: 1) intentionally references itself as its parent (`"parent": 1`). This self-reference is acceptable and should not be flagged as an issue in future reviews.
Learnt from: kemuru
PR: kleros/kleros-v2#1702
File: web/src/pages/Home/TopJurors/JurorCard/index.tsx:10-11
Timestamp: 2024-10-08T16:23:56.291Z
Learning: In the `kleros-v2` codebase, the property `totalResolvedDisputes` should remain and should not be renamed to `totalResolvedVotes`.
📚 Learning: in `usegenesisblock.ts`, within the `useeffect` hook, the conditions (`isklerosuniversity`, `isklero...
Learnt from: Harman-singh-waraich
PR: kleros/kleros-v2#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:

  • contracts/deploy/00-home-chain-arbitration-neo.ts
📚 Learning: in `contracts/config/courts.v2.mainnet-neo.json`, the general court (id: 1) intentionally references...
Learnt from: jaybuidl
PR: kleros/kleros-v2#1746
File: contracts/config/courts.v2.mainnet-neo.json:3-5
Timestamp: 2024-11-19T17:18:39.007Z
Learning: In `contracts/config/courts.v2.mainnet-neo.json`, the General Court (id: 1) intentionally references itself as its parent (`"parent": 1`). This self-reference is acceptable and should not be flagged as an issue in future reviews.

Applied to files:

  • contracts/deploy/00-home-chain-arbitration-neo.ts
  • contracts/deployments/arbitrum/KlerosCoreNeo.json
  • contracts/deployments/arbitrum/SortitionModuleNeo.json
📚 Learning: in `contracts/config/courts.v2.mainnet-neo.json`, the `minstake` parameter is denominated in pnk, no...
Learnt from: jaybuidl
PR: kleros/kleros-v2#1746
File: contracts/config/courts.v2.mainnet-neo.json:167-170
Timestamp: 2024-11-19T16:31:08.965Z
Learning: In `contracts/config/courts.v2.mainnet-neo.json`, the `minStake` parameter is denominated in PNK, not ETH.

Applied to files:

  • contracts/deploy/00-home-chain-arbitration-neo.ts
  • contracts/deployments/arbitrum/KlerosCoreNeo.json
  • contracts/deployments/arbitrum/SortitionModuleNeo.json
  • contracts/deployments/arbitrumSepolia/KlerosCore.json
📚 Learning: in `kleros-sdk/src/sdk.ts`, the `publicclient` type is used and should not be flagged as unused....
Learnt from: Harman-singh-waraich
PR: kleros/kleros-v2#1703
File: kleros-sdk/src/sdk.ts:1-3
Timestamp: 2024-10-22T10:23:15.789Z
Learning: In `kleros-sdk/src/sdk.ts`, the `PublicClient` type is used and should not be flagged as unused.

Applied to files:

  • contracts/deploy/00-home-chain-arbitration-neo.ts
📚 Learning: in `web/src/hooks/queries/usepopulateddisputedata.ts`, the query and subsequent logic only execute w...
Learnt from: Harman-singh-waraich
PR: kleros/kleros-v2#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:

  • contracts/deploy/00-home-chain-arbitration-neo.ts
  • contracts/deployments/arbitrum/DisputeKitClassicNeo.json
  • contracts/deployments/arbitrumSepolia/DisputeKitClassic.json
  • contracts/deployments/arbitrumSepoliaDevnet/DisputeKitClassic.json
📚 Learning: in the `contracts/src/rng/chainlinkrng.sol` contract, the `requestrandomness` function is restricted...
Learnt from: jaybuidl
PR: kleros/kleros-v2#1778
File: contracts/src/rng/ChainlinkRNG.sol:135-153
Timestamp: 2024-12-07T11:39:10.927Z
Learning: In the `contracts/src/rng/ChainlinkRNG.sol` contract, the `requestRandomness` function is restricted to being called only by the `SortitionModule`, which does not send concurrent requests. Therefore, it's acceptable not to handle multiple random number requests concurrently in this context.

Applied to files:

  • contracts/deploy/00-home-chain-arbitration-neo.ts
📚 Learning: in the landing component, it's safe to pass `dispute?.dispute?.arbitrated.id as 0x${string}` to `use...
Learnt from: tractorss
PR: kleros/kleros-v2#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:

  • contracts/deploy/00-home-chain-arbitration-neo.ts
📚 Learning: next.js recommends using the `useeffect` hook to set `isclient` and using `suppresshydrationwarning`...
Learnt from: jaybuidl
PR: kleros/kleros-v2#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:

  • contracts/deploy/00-home-chain-arbitration-neo.ts
📚 Learning: in this typescript project, when a file (such as `kleros-sdk/src/requests/gqlclient.ts`) exports onl...
Learnt from: Harman-singh-waraich
PR: kleros/kleros-v2#1703
File: kleros-sdk/src/requests/gqlClient.ts:18-18
Timestamp: 2024-10-24T08:16:02.749Z
Learning: In this TypeScript project, when a file (such as `kleros-sdk/src/requests/gqlClient.ts`) exports only a single entity, it's acceptable to use default exports instead of named exports.

Applied to files:

  • contracts/deploy/00-home-chain-arbitration-neo.ts
📚 Learning: in typescript code using ethers.js version 6, `contract.target` should be used instead of `contract....
Learnt from: jaybuidl
PR: kleros/kleros-v2#1620
File: contracts/test/arbitration/draw.ts:84-84
Timestamp: 2024-11-05T11:32:11.238Z
Learning: In TypeScript code using ethers.js version 6, `contract.target` should be used instead of `contract.address` to access a contract's address.

Applied to files:

  • contracts/deploy/00-home-chain-arbitration-neo.ts
📚 Learning: in ethers v6, `ethers.tobehex` is the correct method to convert numbers to hex strings....
Learnt from: jaybuidl
PR: kleros/kleros-v2#1620
File: contracts/test/arbitration/draw.ts:98-98
Timestamp: 2024-11-05T11:32:29.452Z
Learning: In Ethers v6, `ethers.toBeHex` is the correct method to convert numbers to hex strings.

Applied to files:

  • contracts/deploy/00-home-chain-arbitration-neo.ts
📚 Learning: the variables 'arbitrablechainid' and 'externaldisputeid' are required by the context to have upperc...
Learnt from: Harman-singh-waraich
PR: kleros/kleros-v2#1703
File: kleros-sdk/src/utils/getDispute.ts:38-40
Timestamp: 2024-10-21T10:32:16.970Z
Learning: The variables 'arbitrableChainID' and 'externalDisputeID' are required by the context to have uppercase 'ID', so they should remain unchanged even if the corresponding source properties use 'Id'.

Applied to files:

  • contracts/deployments/arbitrum/DisputeKitClassicNeo.json
  • contracts/deployments/arbitrumSepolia/DisputeKitClassic.json
  • contracts/deployments/arbitrumSepoliaDevnet/DisputeKitClassic.json
📚 Learning: in solidity, a public state variable automatically implements a corresponding external view function...
Learnt from: jaybuidl
PR: kleros/kleros-v2#1805
File: contracts/src/proxy/UUPSProxiable.sol:127-129
Timestamp: 2025-01-22T00:55:35.842Z
Learning: In Solidity, a public state variable automatically implements a corresponding external view function with the same name. For example, `string public constant override version = "0.8.0"` implements the abstract `function version() external view returns (string memory)`.

Applied to files:

  • contracts/deployments/arbitrum/DisputeKitClassicNeo.json
  • contracts/deployments/arbitrumSepolia/DisputeKitClassic.json
  • contracts/deployments/arbitrum/KlerosCoreNeo.json
  • contracts/deployments/arbitrumSepoliaDevnet/DisputeKitClassic.json
  • contracts/deployments/arbitrumSepolia/KlerosCore.json
📚 Learning: in `contracts/config/courts.v2.mainnet-neo.json`, the general court (id: 1) can have its `parent` id...
Learnt from: jaybuidl
PR: kleros/kleros-v2#1746
File: contracts/config/courts.v2.mainnet-neo.json:3-17
Timestamp: 2024-11-19T16:09:41.467Z
Learning: In `contracts/config/courts.v2.mainnet-neo.json`, the General Court (ID: 1) can have its `parent` ID set to itself (`"parent": 1`), as there is no parent court with ID 0 currently.

Applied to files:

  • contracts/deployments/arbitrum/SortitionModuleNeo.json
⏰ 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). (7)
  • GitHub Check: contracts-testing
  • GitHub Check: Analyze (javascript)
  • GitHub Check: SonarCloud
  • GitHub Check: Mend Security Check
  • GitHub Check: SonarCloud
  • GitHub Check: contracts-testing
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (37)
contracts/deployments/arbitrumSepoliaDevnet/DisputeKitGated.json (1)

1209-1224: Constructor arg ↔ current implementation mismatch – verify upgrade history

The constructor argument _implementation recorded in "args"[0] is
0x89BF27c2148873E0ae4d8c6253C2e4423dF959aF, whereas the "implementation" field later in the artifact is
0xA27EedcEA916BC1ab91720cE70c56666E854F55e.

Unless an upgradeTo/upgradeToAndCall transaction was executed immediately after deployment, this divergence means the artifact no longer reflects the live implementation behind the proxy.
Down-stream tools (frontend ABIs, subgraph handlers, scripts) that rely on this file to locate the logic contract may interact with an outdated address.

Action items

  1. Confirm on-chain whether the proxy was upgraded from 0x89BF… to 0xA27E….
  2. If the upgrade is intentional, update "args" (or remove it) so that the artifact’s internal state is self-consistent, or document the upgrade block/tx in a separate migration record.
  3. Re-generate the deployment artifact after each upgrade to avoid silent desynchronisation.
contracts/deployments/arbitrumSepolia/DisputeKitClassic.json (6)

486-504: Double-check public mapping exposure for dispute activity

coreDisputeIDToActive(uint256) → bool is now publicly exposed.
If multiple cores will ever share the same dispute-kit instance, a single mapping keyed only by _coreDisputeID can collide across cores. Consider either:

- mapping(uint256 => bool) coreDisputeIDToActive;
+ mapping(address core => mapping(uint256 coreDisputeID => bool)) coreDisputeIDToActive;

or deploying separate kits per core to avoid clashes.


757-785: Return-value order must match consumer expectations

getLocalDisputeRoundID now returns (localDisputeID, localRoundID).
Verify that every off-chain helper (keeper bot, subgraph, UI hooks) consumes the tuple in the same positional order; otherwise data-mix-ups will silently propagate.


916-944: Align vote-hashing algorithm across layers

hashVote(uint256 _choice, uint256 _salt, string _justification) is a pure helper.
Ensure the exact same ABI-encoded hashing (likely keccak256(abi.encode(_choice, _salt, _justification))) is re-implemented in:

• the frontend VoteWithCommit* components
• keeper scripts that pre-compute commits

Any deviation will brick commit/reveal.


953-967: Initializer signature change – update all deploy/upgrade scripts

initialize now requires _wNative.
Scripts that previously passed only governor & core will revert. Confirm that:

  1. contracts/deploy/upgrade-all.ts is already adapted (looks so from PR text).
  2. The address supplied in this artefact (0x...) really is the canonical wrapped ETH for Arbitrum Sepolia.

1183-1188: Compiler & bytecode hash drift

solc bumped to 0.8.28 and solcInputHash changed.
Make sure every dependent kit/contract compiled together; mixed-compiler upgrades in the same diamond/proxy tree can yield storage-layout incompatibilities.


1189-1193: Upgrade execution sanity check

The execute stanza shows a direct reinitialize call with the wrapped token address.
Confirm this transaction was sent via the governor and not by EOAs, maintaining the UUPS proxy security model.

contracts/deployments/arbitrumSepolia/KlerosCore.json (5)

1329-1336: Confirm every caller handles the new nbDrawnJurors return value

draw() now returns a uint256 nbDrawnJurors.
• Keeper-bot scripts, dispute-kit contracts, Subgraph handlers, and any off-chain services that used to call draw() for its side-effects only must now read & consume (or safely ignore) the returned value.
• Failing to do so in Solidity can leave the return data on the stack and cause stack too deep issues when the result is forwarded.

Consider grepping for .draw( across the repo to ensure all call-sites have been updated.


1801-1813: Re-initialisation surface – confirm access control & version gating

reinitialize(address _wNative) is now publicly exposed. If not protected by:

  1. a versioned reinitializer(#) modifier and
  2. an onlyGovernor / guardian check (or similar),

any account could alter core fee-token logic post-deployment.

Please confirm the underlying Solidity uses initializer/reinitializer with _initialized < X guard plus role checks.


1868-1885: transferBySortitionModule must be strictly SortitionModuleOnly

Moving PNK from core to jurors is sensitive. Ensure the function is:

onlySortitionModule (or an internal call),
• emits an event for indexing, and
• performs safeTransfer.


1924-1936: Good addition – wNative() view accessor

Providing an accessor for the wrapped-native address improves frontend & subgraph UX.


2030-2041: Deployment metadata drift – compiler / pragma mismatch

The ABI reports solc 0.8.28 while source pragmas in the embedded provenance (pragma solidity ^0.8.24;). This is legal but worth tracking; inadvertent minor-version jumps can change opcode costs (e.g., PUSH0 in 0.8.20).

Confirm CI is compiling every contract with 0.8.28 consistently and that audit tooling covers this version bump.

contracts/deployments/arbitrum/DisputeKitClassicNeo.json (7)

486-504: New coreDisputeIDToActive getter looks fine but double-check downstream usage
The added view neatly exposes dispute liveness and keeps naming in line with coreDisputeIDToLocal. Make sure the subgraph and any front-end helpers now prefer this on-chain source over cached state.


757-785: Confirm consumers are updated for getLocalDisputeRoundID
The twin return values will break existing helpers that assumed a single uint. Search the TS/JS codebase for .getLocalDisputeRoundID( and adapt typings accordingly.


786-804: getNumberOfRounds – check off-chain pagination logic
Adding this utility is welcome. However, some UIs iterate with roundId < dispute.rounds.length; please migrate those loops to call this getter to avoid under/over-fetching.


956-960: initialize signature changed – validate proxy bootstrap path
The constructor‐supplied _data (line 1181) encodes the old 2-arg initializer, so _wNative is not set during UUPSProxy construction. You compensate with a follow-up reinitialize, but be sure:

  1. initialize() now blocks re-entry (AlreadyInitialized)
  2. reinitialize() is version-gated (initializer(2) / reinitializer) and access-controlled (onlyGovernor)
  3. Zero-address _wNative is rejected.

1086-1098: wNative() getter added – good
Exposing the wrapped native token is useful for UI fee calculations. No issues spotted.


1183-1186: Compiler metadata mismatch
metadata.compiler.version is 0.8.28, but the embedded source pragma is ^0.8.24. While compatible, it can confuse sourcify/etherscan verification. Regenerate the proxy stub with matching pragma or pin the pragma to 0.8.28.


1189-1193: Deployment script now calls reinitialize – ensure idempotency
numDeployments bumped to 3 and execute.methodName is reinitialize. Confirm that replaying the deployment script on fresh networks does not call reinitialize twice (would revert) and that migration scripts guard on Initialized(version) events.

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

396-399: Legacy alreadyTransferred flag still present in delayedStakes tuple.

The PR notes that the “alreadyTransferred” bookkeeping was removed, yet the ABI for delayedStakes still exposes this boolean.
Please confirm that the storage layout truly needs to keep the flag; if not, drop it to avoid misleading integrators.

contracts/deploy/00-home-chain-arbitration-neo.ts (6)

9-9: LGTM - Good cleanup of unused imports.

Removing the unused RandomizerRNG import improves code cleanliness while keeping the necessary imports.


13-13: LGTM - Simplified destructuring removes unused property.

Only extracting the deploy method that's actually used in the script is good practice.


35-35: LGTM - Correctly adds WETH support to dispute kit.

The addition of weth.target as a constructor argument aligns with the PR objective to introduce WETH token support across core contracts and dispute kits.


84-84: LGTM - Correctly implements updated KlerosCoreNeo interface.

The addition of weth.target parameter aligns with the updated initialization function signature that now requires the wrapped native token address.


126-146: LGTM - Correctly implements new dispute kit deployments.

The three new dispute kits (Shutter, Gated, and GatedShutter) are properly deployed with consistent constructor arguments and correctly registered with the core contract. This aligns with the PR objective to introduce new dispute kits.


148-148: LGTM - Good addition of clarifying comment.

The comment improves code readability by clearly marking the snapshot proxy deployment section.

contracts/deployments/arbitrum/KlerosCoreNeo.json (6)

1400-1406: LGTM - Draw function correctly returns number of drawn jurors.

The updated return type uint256 nbDrawnJurors aligns with the AI summary stating that the draw function was modified to return the number of jurors drawn during the draw operation.


1749-1754: LGTM - Initialize function correctly adds WETH parameter.

The addition of the address _wNative parameter aligns with the AI summary noting that the initialize function signature was extended to include the wrapped native token address for protocol-wide WETH support.


1889-1901: LGTM - Reinitialize function properly supports contract upgrades.

The new reinitialize function with the _wNative parameter follows standard upgrade patterns and allows existing contracts to be upgraded with WETH support, as mentioned in the AI summary.


1956-1973: LGTM - New transfer function properly supports sortition module operations.

The transferBySortitionModule function provides the necessary permissioned token transfer interface for the sortition module, as described in the AI summary, enhancing the protocol's token management capabilities.


2012-2024: LGTM - wNative function properly exposes wrapped token address.

The new view function correctly provides access to the wrapped native token address, completing the WETH integration by allowing external queries of the configured token.


2118-2129: LGTM - Deployment metadata correctly reflects contract upgrade.

The updated metadata shows proper progression: increased deployment count to 3, updated Solidity compiler to 0.8.28, new implementation address, and execute method calling reinitialize with the WETH token address, all consistent with the protocol upgrade.

contracts/deployments/arbitrumSepoliaDevnet/DisputeKitClassic.json (5)

2-2: New proxy address introduced – check downstream configs

"address": "0xeEEbbbff8f377dCFc7d4F7876C531db0d22720e1" supersedes the previous Classic DK proxy.
Please update environment variables, subgraph networks.json, hard-coded addresses in keeper/SDK scripts, and any CI secrets that whitelist the old address.


324-352: alreadyDrawn() ABI addition – make sure indexers & bots are upgraded

The new view helps keeper bots avoid double draws. Ensure:

  1. Subgraph mappings listen for it (or fetch it) before emitting JurorDrawn.
  2. Front-end queries are regenerated (typechain / wagmi).

Missing updates will silently break draw workflows.


757-785: Tuple order of getLocalDisputeRoundID() – double-check TypeChain typings

The function returns (localDisputeID, localRoundID).
Type generation tools sometimes reorder unnamed tuple fields; bump the SDK and re-generate types to avoid mis-mapping.


1086-1098: Expose wNative() – front-end & payout logic must now rely on it

Replace hard-coded WETH/WMATIC addresses with this getter to stay chain-agnostic.


1189-1193: Deployment executes reinitialize – confirm the intended upgrade path

Using execute.methodName = "reinitialize" on first deployment is unusual for a UUPS proxy.
Make sure:

  1. The proxy was already initialized once (upgrade scenario).
  2. The storage gap is respected.

Otherwise, you might be locking the proxy in an uninitialized state.

@jaybuidl
Copy link
Member Author

jaybuidl commented Aug 2, 2025

@coderabbitai resolve

Copy link
Contributor

coderabbitai bot commented Aug 2, 2025

✅ Actions performed

Comments resolved and changes approved.

coderabbitai[bot]
coderabbitai bot previously approved these changes Aug 2, 2025
Copy link

sonarqubecloud bot commented Aug 2, 2025

@jaybuidl jaybuidl merged commit f979978 into master Aug 2, 2025
27 of 32 checks passed
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.

6 participants