-
Notifications
You must be signed in to change notification settings - Fork 51
Release #2076
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
base: master
Are you sure you want to change the base?
Release #2076
Changes from 24 commits
78b3169
738ef2c
82f8b1c
52f86ac
a374113
a0cb09d
5353ccf
831b062
3d211cc
95f2803
277457c
d1910ca
8d0edf4
c1bad1d
be33847
cabc743
b19b82d
1dbfedf
37bd43f
0a10ad2
257870c
4a451a5
5ca5c3b
bd4e169
31efb24
96e48f8
0f31e0e
d63d000
78f180a
413a85a
9895c7c
2f711f3
da90234
0cadf21
e6572d5
635aa6d
9401c9b
8f4993d
3b59568
f02d718
f2b2183
03376da
524116c
9618a6f
5468d55
1aae950
208e009
42cc971
057957e
d0a9a80
f734873
582b674
e4d4bdb
1d37d89
3ed7310
c9e7334
ea5b3a7
361fa55
6636c6d
e6114ba
9d31252
baf9695
4cc634f
14fedbb
63d3a64
e6e83ae
1d1f9f2
b7888c2
d3c215e
323ba18
953bd95
d794975
62b0a50
a7cfba0
1ba64db
068df77
188f8d0
bd589e7
6f92514
2cfeec4
4aa2cd2
b490c96
ef3a64c
fb6ca6a
5e987c4
98f7eac
030eedf
6ded616
63744e9
262f940
bd210be
40714da
758a809
7a5d08d
e9f8a0a
923bd7b
daa8bf9
4e384c9
8636c23
36a2455
59ca8e1
5dc39fa
79a458c
1ec4e02
f1ec484
8b6e1f9
7a78b27
83a21bd
6bea072
62d5723
0e3fb9c
f77b92f
e41329b
8f438dd
8032917
1b6c98a
568eb40
96bb505
78833f3
4530869
cfdb1f4
7c30463
e7578d2
bd983ca
c97270a
f1dd559
fd465a4
8ecf061
41a5b77
cbc111a
452246f
e59e79b
e7971b8
835eea4
d82188a
79e4210
e1a3d05
55589e5
9d4b286
4f35c9d
e3dc195
942fa9e
20ae3a4
e2d7c81
b9a7a97
48abffb
859834b
56aaca8
94e4783
a8d32b8
0e96a87
6752cad
65f84cf
2842949
e827f63
6b74ebc
df07fbb
835d45b
5b35be9
06db2d0
615effc
11f84f7
ec9e89c
40d2240
45bcd0f
06cccaa
7cb1275
bc906e5
4d14f47
e21d261
cf59b86
f70050e
decd3e7
00be694
536e61c
374b4f2
f9fd944
a0a3a67
a934ba5
6b7e365
5a46536
87e5759
bcbe228
83a8ba6
700738e
cefa0cb
13f3708
3a930be
613b8c3
57319d4
8ab5d63
ca59e71
780e00a
c279eff
c40c12c
fac9901
973f572
6cbd494
5276f64
91ccfe9
d03832d
e2daec5
bbcc819
7df6109
0b4cb0c
8704a3c
ad1ff0d
6d76559
b22899c
4a3c20f
f8536e6
b6ca2ad
f5f3079
7f64aba
32fe70a
8795f88
2dd02dc
877ed81
578d4d5
42f721c
6b8970a
592243f
643d561
33f84ad
72062e7
487c5e9
697dac8
87d2a70
e5aa70c
81f8290
1193c19
d6cc3be
a3c9f91
4128c77
47e1280
cf2dcc7
4330108
318d311
a6d8672
e40034f
a2c372d
16e7af5
59a67a0
9d72238
e16934e
eca8874
117cfb0
ba50923
9197bbd
4cdb9f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,7 +4,27 @@ All notable changes to this package will be documented in this file. | |||||||||
|
|
||||||||||
| The format is based on [Common Changelog](https://common-changelog.org/). | ||||||||||
|
|
||||||||||
| ## [0.11.0] - 2025-08-01 | ||||||||||
| ## [0.13.0] - 2025-08-07 (Not published yet) | ||||||||||
|
|
||||||||||
| ### Changed | ||||||||||
|
|
||||||||||
| - Set the Hardhat Solidity version to v0.8.30 and enable the IR pipeline ([#2069](https://github.com/kleros/kleros-v2/issues/2069)) | ||||||||||
| - Set the Foundry Solidity version to v0.8.30 and enable the IR pipeline ([#2073](https://github.com/kleros/kleros-v2/issues/2073)) | ||||||||||
| - Widen the allowed solc version to any v0.8.x for the interfaces only ([#2083](https://github.com/kleros/kleros-v2/issues/2083)) | ||||||||||
| - Bump `hardhat` to v2.26.2 ([#2069](https://github.com/kleros/kleros-v2/issues/2069)) | ||||||||||
| - Bump `@kleros/vea-contracts` to v0.7.0 ([#2073](https://github.com/kleros/kleros-v2/issues/2073)) | ||||||||||
|
|
||||||||||
| ## [0.12.0] - 2025-08-05 | ||||||||||
|
|
||||||||||
| ### Changed | ||||||||||
|
|
||||||||||
| - **Breaking:** Make `viem` a peer dependency, it should be provided by the consuming package ([`4594536`](https://github.com/kleros/kleros-v2/commit/4594536c)) | ||||||||||
|
|
||||||||||
| ### Added | ||||||||||
|
|
||||||||||
| - Add helper function `getDisputeKitsViem` to retrieve a deployment's available dispute kit infos including their capabilities (`isShutter`, `isGated`) ([`5a81f9e`](https://github.com/kleros/kleros-v2/commit/5a81f9ec)) | ||||||||||
|
|
||||||||||
| ## [0.11.0] - 2025-08-02 | ||||||||||
jaybuidl marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
|
|
||||||||||
| ### Changed | ||||||||||
|
|
||||||||||
|
|
@@ -107,6 +127,8 @@ The format is based on [Common Changelog](https://common-changelog.org/). | |||||||||
|
|
||||||||||
| ## [0.8.1] - 2025-04-10 | ||||||||||
|
|
||||||||||
| [0.13.0]: https://github.com/kleros/kleros-v2/releases/tag/@kleros%2Fkleros-v2-contracts@0.13.0 | ||||||||||
| [0.12.0]: https://github.com/kleros/kleros-v2/releases/tag/@kleros%2Fkleros-v2-contracts@0.12.0 | ||||||||||
|
Comment on lines
+174
to
+175
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainAvoid adding a release link for an unpublished tag. If 0.13.0 isn’t published, this link will 404. Add it only when the release is live. -[0.13.0]: https://github.com/kleros/kleros-v2/releases/tag/@kleros%2Fkleros-v2-contracts@0.13.0
+<!-- [0.13.0]: (add after publishing) -->Optionally confirm release existence before merging: 🏁 Script executed: #!/bin/bash
# Prints 200 if the tag exists, otherwise likely 404
curl -s -o /dev/null -w "%{http_code}\n" \
"https://github.com/kleros/kleros-v2/releases/tag/@kleros%2Fkleros-v2-contracts@0.13.0"Length of output: 132 Remove unpublished release link for v0.13.0 in CHANGELOG.md The • File: Recommended change: -[0.13.0]: https://github.com/kleros/kleros-v2/releases/tag/@kleros%2Fkleros-v2-contracts@0.13.0
+<!-- [0.13.0]: (add after publishing) -->📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| [0.11.0]: https://github.com/kleros/kleros-v2/releases/tag/@kleros%2Fkleros-v2-contracts@0.11.0 | ||||||||||
| [0.10.0]: https://github.com/kleros/kleros-v2/releases/tag/@kleros%2Fkleros-v2-contracts@0.10.0 | ||||||||||
| [0.9.4]: https://github.com/kleros/kleros-v2/releases/tag/@kleros%2Fkleros-v2-contracts@0.9.4 | ||||||||||
|
|
||||||||||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,85 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { getContracts } from "./contractsViem"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Abi, AbiEvent, getAbiItem, PublicClient } from "viem"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { DeploymentName } from "./utils"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export type DisputeKitContracts = ReturnType<typeof getContracts>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export type DisputeKit = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | NonNullable<DisputeKitContracts["disputeKitClassic"]> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | NonNullable<DisputeKitContracts["disputeKitShutter"]> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | NonNullable<DisputeKitContracts["disputeKitGated"]> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | NonNullable<DisputeKitContracts["disputeKitGatedShutter"]> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export type DisputeKitInfos = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| address: `0x${string}`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| contract: DisputeKit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isGated: boolean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isShutter: boolean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export type DisputeKitByIds = Record<string, DisputeKitInfos>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const fetchDisputeKits = async (client: PublicClient, klerosCoreAddress: `0x${string}`, klerosCoreAbi: Abi) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const DisputeKitCreated = getAbiItem({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| abi: klerosCoreAbi, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: "DisputeKitCreated", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) as AbiEvent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+21
to
+24
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Unsafe type assertion - add runtime validation. The type assertion - const DisputeKitCreated = getAbiItem({
- abi: klerosCoreAbi,
- name: "DisputeKitCreated",
- }) as AbiEvent;
+ const DisputeKitCreated = getAbiItem({
+ abi: klerosCoreAbi,
+ name: "DisputeKitCreated",
+ });
+
+ if (!DisputeKitCreated || DisputeKitCreated.type !== 'event') {
+ throw new Error('DisputeKitCreated event not found in ABI');
+ }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const logs = await client.getLogs({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| address: klerosCoreAddress, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| event: DisputeKitCreated, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fromBlock: 0n, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| toBlock: "latest", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+20
to
+30
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider performance implications of unbounded block range. Fetching events from block 0 to latest will become increasingly expensive as the chain grows. Consider adding block range parameters or caching mechanisms for production use. -const fetchDisputeKits = async (client: PublicClient, klerosCoreAddress: `0x${string}`, klerosCoreAbi: Abi) => {
+const fetchDisputeKits = async (
+ client: PublicClient,
+ klerosCoreAddress: `0x${string}`,
+ klerosCoreAbi: Abi,
+ fromBlock: bigint = 0n
+) => {
const DisputeKitCreated = getAbiItem({
abi: klerosCoreAbi,
name: "DisputeKitCreated",
}) as AbiEvent;
const logs = await client.getLogs({
address: klerosCoreAddress,
event: DisputeKitCreated,
- fromBlock: 0n,
+ fromBlock,
toBlock: "latest",
});📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return Object.fromEntries( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .filter((log) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const args = log.args as Record<string, unknown>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return "_disputeKitID" in args && "_disputeKitAddress" in args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .map((log) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { _disputeKitID, _disputeKitAddress } = log.args as { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _disputeKitID: bigint; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _disputeKitAddress: string; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| disputeKitID: _disputeKitID, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| disputeKitAddress: _disputeKitAddress, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .map(({ disputeKitID, disputeKitAddress }) => [disputeKitID!.toString(), disputeKitAddress as `0x${string}`]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+31
to
+49
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add error handling for blockchain interactions. The function lacks error handling for potential RPC failures or malformed event data. Wrap the blockchain interaction in try-catch: + try {
const logs = await client.getLogs({
address: klerosCoreAddress,
event: DisputeKitCreated,
fromBlock: 0n,
toBlock: "latest",
});
+ } catch (error) {
+ throw new Error(`Failed to fetch DisputeKitCreated events: ${error}`);
+ }
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const getDisputeKits = async (client: PublicClient, deployment: DeploymentName): Promise<DisputeKitByIds> => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { klerosCore, disputeKitClassic, disputeKitShutter, disputeKitGated, disputeKitGatedShutter } = getContracts({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| publicClient: client, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| deployment: deployment, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const isDefined = <T>(kit: T): kit is NonNullable<T> => kit != null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const disputeKitContracts = [disputeKitClassic, disputeKitShutter, disputeKitGated, disputeKitGatedShutter].filter( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isDefined | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const shutterEnabled = [disputeKitShutter, disputeKitGatedShutter].filter(isDefined); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const gatedEnabled = [disputeKitGated, disputeKitGatedShutter].filter(isDefined); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const disputeKitMap = await fetchDisputeKits(client, klerosCore.address, klerosCore.abi); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return Object.fromEntries( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Object.entries(disputeKitMap).map(([disputeKitID, address]) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const contract = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| disputeKitContracts.find((contract) => contract.address.toLowerCase() === address.toLowerCase()) ?? null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| disputeKitID, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| address, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| contract: contract satisfies DisputeKit, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isGated: contract | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? gatedEnabled.some((gated) => contract.address.toLowerCase() === gated.address.toLowerCase()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isShutter: contract | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? shutterEnabled.some((shutter) => contract.address.toLowerCase() === shutter.address.toLowerCase()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
| "name": "@kleros/kleros-v2-contracts", | ||||||||||||||||||||||||||||||||||||
| "version": "0.11.0", | ||||||||||||||||||||||||||||||||||||
| "version": "0.12.0", | ||||||||||||||||||||||||||||||||||||
| "description": "Smart contracts for Kleros version 2", | ||||||||||||||||||||||||||||||||||||
| "main": "./cjs/deployments/index.js", | ||||||||||||||||||||||||||||||||||||
| "module": "./esm/deployments/index.js", | ||||||||||||||||||||||||||||||||||||
|
|
@@ -121,7 +121,7 @@ | |||||||||||||||||||||||||||||||||||
| "@types/mocha": "^10.0.10", | ||||||||||||||||||||||||||||||||||||
| "@types/node": "^20.17.6", | ||||||||||||||||||||||||||||||||||||
| "@types/sinon": "^17.0.4", | ||||||||||||||||||||||||||||||||||||
| "@wagmi/cli": "^2.2.0", | ||||||||||||||||||||||||||||||||||||
| "@wagmi/cli": "^2.3.2", | ||||||||||||||||||||||||||||||||||||
| "abitype": "^0.10.3", | ||||||||||||||||||||||||||||||||||||
| "chai": "^4.5.0", | ||||||||||||||||||||||||||||||||||||
| "dotenv": "^16.6.1", | ||||||||||||||||||||||||||||||||||||
|
|
@@ -131,7 +131,7 @@ | |||||||||||||||||||||||||||||||||||
| "gluegun": "^5.2.0", | ||||||||||||||||||||||||||||||||||||
| "graphql": "^16.9.0", | ||||||||||||||||||||||||||||||||||||
| "graphql-request": "^7.1.2", | ||||||||||||||||||||||||||||||||||||
| "hardhat": "2.25.0", | ||||||||||||||||||||||||||||||||||||
| "hardhat": "2.26.2", | ||||||||||||||||||||||||||||||||||||
| "hardhat-contract-sizer": "^2.10.0", | ||||||||||||||||||||||||||||||||||||
| "hardhat-deploy": "^1.0.4", | ||||||||||||||||||||||||||||||||||||
| "hardhat-deploy-ethers": "^0.4.2", | ||||||||||||||||||||||||||||||||||||
|
|
@@ -154,10 +154,17 @@ | |||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
| "dependencies": { | ||||||||||||||||||||||||||||||||||||
| "@chainlink/contracts": "^1.4.0", | ||||||||||||||||||||||||||||||||||||
| "@kleros/vea-contracts": "^0.6.0", | ||||||||||||||||||||||||||||||||||||
| "@kleros/vea-contracts": "^0.7.0", | ||||||||||||||||||||||||||||||||||||
| "@openzeppelin/contracts": "^5.4.0", | ||||||||||||||||||||||||||||||||||||
| "@shutter-network/shutter-sdk": "0.0.2", | ||||||||||||||||||||||||||||||||||||
| "isomorphic-fetch": "^3.0.0", | ||||||||||||||||||||||||||||||||||||
| "isomorphic-fetch": "^3.0.0" | ||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
| "peerDependencies": { | ||||||||||||||||||||||||||||||||||||
| "viem": "^2.24.1" | ||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
| "peerDependenciesMeta": { | ||||||||||||||||||||||||||||||||||||
| "viem": { | ||||||||||||||||||||||||||||||||||||
| "optional": false | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
| "peerDependencies": { | |
| "viem": "^2.24.1" | |
| }, | |
| "peerDependenciesMeta": { | |
| "viem": { | |
| "optional": false | |
| } | |
| } | |
| "peerDependencies": { | |
| - "viem": "^2.24.1" | |
| + "viem": "^2.23.0" | |
| }, | |
| "peerDependenciesMeta": { | |
| "viem": { | |
| "optional": false | |
| } | |
| } |
🤖 Prompt for AI Agents
In contracts/package.json around lines 162 to 169, the peer dependency version
for "viem" (^2.24.1) conflicts with the root workspace resolution (^2.23.2),
causing warnings and potential inconsistent behavior. To fix this, update the
root package.json to use "viem" version ^2.24.1 to match the peer dependency, or
alternatively, relax the peer dependency in this package.json to ^2.23.2 if you
must stay on that version, understanding this may limit access to newer
features.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,23 @@ | ||||||||||||||||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| SOURCE_DIR="src" | ||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Define a default output path before strict mode makes it mandatory. Once -SOURCE_DIR="${SCRIPT_DIR}/../src"
+SOURCE_DIR="${SCRIPT_DIR}/../src"
+OUTPUT_FILE="${OUTPUT_FILE:-${SCRIPT_DIR}/../METRICS.html}"
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
| SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | |
| SOURCE_DIR="src" | |
| #!/usr/bin/env bash | |
| set -Eeuo pipefail | |
| # Fail if any glob doesn’t match; helps catch missing files/typos. | |
| shopt -s failglob | |
| SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | |
| # Source directory relative to this script (contracts/scripts -> contracts/src). | |
| SOURCE_DIR="$SCRIPT_DIR/../src" | |
| # Allow overriding output path via env; defaults to CWD/METRICS.md. | |
| OUTPUT_FILE="${OUTPUT_FILE:-METRICS.md}" |
🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 3-3: SCRIPT_DIR appears unused. Verify use (or export if used externally).
(SC2034)
🤖 Prompt for AI Agents
In contracts/scripts/generateMetrics.sh around lines 3 to 6, SCRIPT_DIR is
computed but unused and SOURCE_DIR is a relative path; enable strict mode and
anchor SOURCE_DIR to the script location: add a strict-mode header (set -euo
pipefail and a safe IFS) at the top of the script, keep or keep-and-use the
existing SCRIPT_DIR variable, and change SOURCE_DIR to reference SCRIPT_DIR
(e.g., SOURCE_DIR="${SCRIPT_DIR}/src") so paths are robust regardless of the
caller's CWD.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Avoid truncating METRICS.md on failure; write atomically via a temp file.
As written, shell truncates METRICS.md before yarn runs; a failure produces an empty report. Write to a temp file and move on success.
Apply this diff:
-yarn dlx solidity-code-metrics \
- "$SOURCE_DIR"/arbitration/KlerosCore* \
- "$SOURCE_DIR"/arbitration/PolicyRegistry.sol \
- "$SOURCE_DIR"/arbitration/SortitionModule* \
- "$SOURCE_DIR"/arbitration/arbitrables/DisputeResolver.sol \
- "$SOURCE_DIR"/arbitration/DisputeTemplateRegistry.sol \
- "$SOURCE_DIR"/arbitration/dispute-kits/* \
- "$SOURCE_DIR"/arbitration/evidence/EvidenceModule.sol \
- "$SOURCE_DIR"/arbitration/interfaces/* \
- "$SOURCE_DIR"/libraries/Constants.sol \
- "$SOURCE_DIR"/libraries/Safe* \
- "$SOURCE_DIR"/rng/RNGWithFallback.sol \
- "$SOURCE_DIR"/rng/ChainlinkRNG.sol \
- "$SOURCE_DIR"/rng/IRNG.sol \
- "$SOURCE_DIR"/proxy/UUPSProx* \
- "$SOURCE_DIR"/proxy/Initializable.sol \
->METRICS.md
+TMP_OUT="$(mktemp)"
+yarn dlx solidity-code-metrics \
+ "$SOURCE_DIR"/arbitration/KlerosCore* \
+ "$SOURCE_DIR"/arbitration/PolicyRegistry.sol \
+ "$SOURCE_DIR"/arbitration/SortitionModule* \
+ "$SOURCE_DIR"/arbitration/arbitrables/DisputeResolver.sol \
+ "$SOURCE_DIR"/arbitration/DisputeTemplateRegistry.sol \
+ "$SOURCE_DIR"/arbitration/dispute-kits/* \
+ "$SOURCE_DIR"/arbitration/evidence/EvidenceModule.sol \
+ "$SOURCE_DIR"/arbitration/interfaces/* \
+ "$SOURCE_DIR"/libraries/Constants.sol \
+ "$SOURCE_DIR"/libraries/Safe* \
+ "$SOURCE_DIR"/rng/RNGWithFallback.sol \
+ "$SOURCE_DIR"/rng/ChainlinkRNG.sol \
+ "$SOURCE_DIR"/rng/IRNG.sol \
+ "$SOURCE_DIR"/proxy/UUPSProx* \
+ "$SOURCE_DIR"/proxy/Initializable.sol \
+>"$TMP_OUT"
+mv "$TMP_OUT" "$OUTPUT_FILE"Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In contracts/scripts/generateMetrics.sh around lines 7 to 23, the current
redirection (>) truncates METRICS.md before yarn runs so a failure leaves an
empty file; change the script to write output to a temporary file (use mktemp or
similar), run the yarn dlx command redirecting stdout/stderr into that temp
file, check the command exit status, on success mv the temp file to METRICS.md
(atomic replacement), and on failure remove the temp file and exit with a
non-zero status; also ensure the temp file is created securely and cleaned up in
all error paths.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import { getDisputeKits } from "../deployments/disputeKitsViem"; | ||
| import { createPublicClient, http } from "viem"; | ||
| import { arbitrumSepolia } from "viem/chains"; | ||
|
|
||
| const rpc = process.env.ARBITRUM_SEPOLIA_RPC; | ||
| if (!rpc) { | ||
| throw new Error("ARBITRUM_SEPOLIA_RPC is not set"); | ||
| } | ||
|
|
||
| const client = createPublicClient({ | ||
| chain: arbitrumSepolia, | ||
| transport: http(rpc), | ||
| }); | ||
|
|
||
| async function main() { | ||
| try { | ||
| console.log("Fetching DisputeKitCreated events..."); | ||
| const disputeKitResult = await getDisputeKits(client, "devnet"); | ||
| console.log(disputeKitResult); | ||
| } catch (error) { | ||
| console.error("Error fetching events:", error); | ||
| throw error; | ||
| } | ||
| } | ||
|
|
||
| if (require.main === module) { | ||
| main() | ||
| .then(() => process.exit(0)) | ||
| .catch((error) => { | ||
| console.error(error); | ||
| process.exit(1); | ||
| }); | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -77,7 +77,8 @@ | |||||||||||||
| "elliptic@npm:6.5.4": "npm:6.6.1", | ||||||||||||||
| "word-wrap@npm:~1.2.3": "npm:1.2.5", | ||||||||||||||
| "@codemirror/state": "npm:6.5.2", | ||||||||||||||
| "undici@npm:7.3.0": "npm:7.5.0" | ||||||||||||||
| "undici@npm:7.3.0": "npm:7.5.0", | ||||||||||||||
| "viem@npm:2.x": "npm:^2.23.2" | ||||||||||||||
|
Comment on lines
+80
to
+81
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainAlign viem resolution with contracts’ peer dependency to avoid peer conflicts. Root resolution pins viem 2.x to ^2.23.2, while contracts require viem ^2.24.1 as a peer. This will trigger peer resolution warnings/errors in Yarn 4 and could break consumers. Update the resolution to satisfy the peer: "resolutions": {
...
- "viem@npm:2.x": "npm:^2.23.2"
+ "viem@npm:2.x": "npm:^2.24.1"
},To check for other mismatches: 🏁 Script executed: #!/bin/bash
rg -n --json '"viem"\s*:\s*"' | jq -r '.data.path.text + ":" + .data.line_number|tostring + " " + .data.lines.text'Length of output: 1417 🏁 Script executed: #!/bin/bash
# Search for all references to “viem” in any JSON file to spot mismatched pins
rg -n '"viem"' -g '*.json'Length of output: 440 Update viem resolution to match peerDependency (^2.24.1) All of your sub-packages (contracts, web, kleros-sdk, web-devtools, kleros-app) declare viem at ^2.24.1, but the root • File: package.json (root) "resolutions": {
…
- "viem@npm:2.x": "npm:^2.23.2"
+ "viem@npm:2.x": "npm:^2.24.1"
},📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| }, | ||||||||||||||
| "scripts": { | ||||||||||||||
| "check-prerequisites": "scripts/check-prerequisites.sh", | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Unrecognized solcover option "irMinimum" — likely a no-op; remove to avoid confusion
I don’t see "irMinimum" in solidity-coverage’s documented options. With coverage.sh already forcing VIA_IR=false for Hardhat, this flag is unnecessary and potentially misleading.
Apply this diff to remove it:
- irMinimum: true,If you want an inline hint about IR for coverage runs, consider a comment:
configureYulOptimizer: true, + // IR is disabled for coverage via scripts/coverage.sh (VIA_IR=false)Optionally verify support via docs:
🌐 Web query:
💡 Result:
Yes. The .solcover.js config includes a documented irMinimum option: a boolean (default false) that “speeds up test execution times when solc is run in viaIR mode,” and it may not work for all projects.[1]
Details:
You can set it in .solcover.js like:
module.exports = {
irMinimum: true
}
Mirrors of the same table appear in downstream copies of the docs as well.[2]
Citations:
Documented option “irMinimum” is redundant under VIA_IR=false
solidity-coverage does support
irMinimum(boolean, default false) to speed up test runs when compiling via IR, but yourcoverage.shscript forcesVIA_IR=false, so this setting has no effect and may confuse future maintainers.• Location: contracts/.solcover.js (line 10)
• Suggested change:
🤖 Prompt for AI Agents