Skip to content

Commit f979978

Browse files
authored
Merge pull request #2012 from kleros/dev
Release
2 parents 6f5a03c + c8185bd commit f979978

File tree

293 files changed

+80106
-6270
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

293 files changed

+80106
-6270
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@ contracts/tenderly.yaml
1111

1212
*/.DS_Store
1313
*/*.log
14+
15+
.env*
16+
.flaskenv*
17+
!.env.project
18+
!.env.vault

.github/workflows/contracts-testing.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ jobs:
4646
- name: Set up corepack (for yarn)
4747
run: |
4848
corepack enable
49-
corepack prepare yarn@4.5.1 --activate
50-
yarn set version 4.5.1
49+
corepack prepare yarn@4.9.2 --activate
50+
yarn set version 4.9.2
5151
5252
- name: Setup Node.js environment
5353
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,8 @@ subgraph/*/contracts/*
202202

203203
# Local Netlify folder
204204
.netlify
205+
206+
.env*
207+
.flaskenv*
208+
!.env.project
209+
!.env.vault

.yarn/releases/yarn-4.8.1.cjs

Lines changed: 0 additions & 935 deletions
This file was deleted.

.yarn/releases/yarn-4.9.2.cjs

Lines changed: 942 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ logFilters:
1212

1313
nodeLinker: node-modules
1414

15-
yarnPath: .yarn/releases/yarn-4.8.1.cjs
15+
yarnPath: .yarn/releases/yarn-4.9.2.cjs

contracts/.env.example

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,14 @@ GNOSISSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
1414
# For the bots
1515
LOG_LEVEL=debug
1616
SUBGRAPH_URL=https://api.studio.thegraph.com/query/61738/kleros-v2-core-devnet/version/latest
17-
LOGTAIL_TOKEN_KEEPER_BOT=cqPqBofVC8nmA8EZdZGqqvUV
18-
LOGTAIL_TOKEN_RELAYER_BOT=41h8q5Z4gnz5yDx215eqcQ4r
19-
LOGTAIL_TOKEN_DISPUTOR_BOT=mSryyvYubviaMqKDWfBKAGsi
20-
HEARTBEAT_URL_KEEPER_BOT=https://uptime.betterstack.com/api/v1/heartbeat/jc23S8ZZzpf8KbzwxL1hoBp9
21-
HEARTBEAT_URL_RELAYER_BOT=https://uptime.betterstack.com/api/v1/heartbeat/eT6Trk6CddJV6fFBbqZNzyqC
17+
LOGTAIL_TOKEN_KEEPER_BOT=ABC123ABC123ABC123ABC
18+
LOGTAIL_TOKEN_RELAYER_BOT=ABC123ABC123ABC123ABC
19+
LOGTAIL_TOKEN_DISPUTOR_BOT=ABC123ABC123ABC123ABC
20+
HEARTBEAT_URL_KEEPER_BOT=https://uptime.betterstack.com/api/v1/heartbeat/ABC123ABC123ABC123ABC
21+
SHUTTER_API=testnet
22+
SHUTTER_API_KEY=
2223
DISPUTES_TO_SKIP=
2324

2425
# Optionally for debugging
2526
# TENDERLY_USERNAME=your_username
2627
# TENDERLY_PROJECT=your_project
27-
28-
# Used by the "hardhat.config.ts" file and important to set them for the "scripts/simulations" tasks
29-
ARB_GOERLI_PRIVATE_KEY_WALLET_1=
30-
ARB_GOERLI_PRIVATE_KEY_WALLET_2=
31-
ARB_GOERLI_PRIVATE_KEY_WALLET_3=
32-
ARB_GOERLI_PRIVATE_KEY_WALLET_4=
33-
ARB_GOERLI_PRIVATE_KEY_WALLET_5=

contracts/.solcover.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const shell = require("shelljs");
66

77
module.exports = {
88
istanbulReporter: ["lcov"],
9+
configureYulOptimizer: true,
910
onCompileComplete: async function (_config) {
1011
await run("typechain");
1112
},

contracts/CHANGELOG.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Changelog
2+
3+
All notable changes to this package will be documented in this file.
4+
5+
The format is based on [Common Changelog](https://common-changelog.org/).
6+
7+
## [0.11.0] - 2025-08-01
8+
9+
### Changed
10+
11+
- **Breaking:** Add an extra wNative parameter to the initializer of `KlerosCoreBase` and `DisputeKitBase` and their descendants ([#2041](https://github.com/kleros/kleros-v2/issues/2041))
12+
- **Breaking:** Add an extra wNative parameter to the constructor of `KlerosGovernor` ([#2041](https://github.com/kleros/kleros-v2/issues/2041))
13+
- **Breaking:** Upgrade Mainnet Beta to v0.11.0 ([`ea9dcc95`](https://github.com/kleros/kleros-v2/commit/ea9dcc95))
14+
- **Breaking:** Upgrade Devnet and Testnet to v0.11.0 ([`b9e847d`](https://github.com/kleros/kleros-v2/commit/b9e847d9))
15+
- Fallback to sending wETH if sending ETH fails ([#2041](https://github.com/kleros/kleros-v2/issues/2041))
16+
- Automate `SortitionModule.withdrawLeftoverPNK()` using the keeper bot ([`97ba58a`](https://github.com/kleros/kleros-v2/commit/97ba58a))
17+
- Upgrade Testnet to v0.10.0 ([#2058](https://github.com/kleros/kleros-v2/issues/2058))
18+
- Support the Gated and Shutter Gated dispute kits by the keeper bot ([`026fe83`](https://github.com/kleros/kleros-v2/commit/026fe83))
19+
- Support the Gated and Shutter Gated dispute kits by the contracts getter tests ([`2166ee0`](https://github.com/kleros/kleros-v2/commit/2166ee0))
20+
- Draw jurors with a more number of iterations to account for ineligible jurors by the keeper bot ([`6eb5bc6`](https://github.com/kleros/kleros-v2/commit/6eb5bc6))
21+
- Bump `@shutter-network/shutter-sdk` to 0.0.2 ([#2049](https://github.com/kleros/kleros-v2/issues/2049))
22+
23+
### Added
24+
25+
- **Breaking:** Add new dispute kits to Mainnet Beta: Shutter, Gated, Gated Shutter ([`ea9dcc95`](https://github.com/kleros/kleros-v2/commit/ea9dcc95))
26+
- **Breaking:** Add new dispute kits to Testnet: Shutter, Gated, Gated Shutter ([`b9e847d`](https://github.com/kleros/kleros-v2/commit/b9e847d9))
27+
28+
### Fixed
29+
30+
- Do not push address(0) in `DisputeKitBase.round.votes` during `draw()` when there is no staked juror in the court ([#2059](https://github.com/kleros/kleros-v2/issues/2059))
31+
- Reduce Neo core contract size below limit by 144 bytes by extracting internal functions for repeated code and by making the `appealPeriod()` view external. ([`4a84534`](https://github.com/kleros/kleros-v2/commit/4a845346))
32+
33+
## [0.10.0] - 2025-07-20
34+
35+
### Changed
36+
37+
- **Breaking:** Redeploy the Devnet contracts ([`b8a2a15`](https://github.com/kleros/kleros-v2/commit/b8a2a15))
38+
- **Breaking:** Update the Devnet contract artifacts, add getter for the new Shutter, Gated and Gated Shutter dispute kits ([`5ef5f23`](https://github.com/kleros/kleros-v2/commit/5ef5f23))
39+
- **Breaking**: Make `KlerosCoreBase.draw()` return the number of drawn jurors ([`54d83a7`](https://github.com/kleros/kleros-v2/commit/54d83a7))
40+
- **Breaking**: Make `SortitionModule.penalizeStake()` return `(uint256 pnkBalance, uint256 availablePenalty)` ([#2004](https://github.com/kleros/kleros-v2/issues/2004))
41+
- **Breaking**: Split SortitionModuleBase.setStake() into 2 functions: `validateStake()` and `setStake()` ([#2004](https://github.com/kleros/kleros-v2/issues/2004))
42+
- Avoid unnecessary calls `KlerosCoreBase.draw()` by the keeper bot when no juror is available ([`54d83a7`](https://github.com/kleros/kleros-v2/commit/54d83a7))
43+
- Migrate the contracts verification tooling to the etherscan v2 API ([`b8a2a15`](https://github.com/kleros/kleros-v2/commit/b8a2a15))
44+
- Bump contract Solidity version to v0.8.28 ([`6e535cc`](https://github.com/kleros/kleros-v2/commit/6e535cc))
45+
- Bump contract dependencies, `hardhat` to v2.26.0 `node` to v20, `yarn` to 4.9.2 ([`6e535cc`](https://github.com/kleros/kleros-v2/commit/6e535cc))
46+
- Deprecate struct field `SortitionModuleBase.SortitionSumTree.alreadyTransferred` ([#2004](https://github.com/kleros/kleros-v2/issues/2004))
47+
- Deprecate state variable `SortitionModuleBase.latestDelayedStakeIndex` ([#2004](https://github.com/kleros/kleros-v2/issues/2004))
48+
49+
### Added
50+
51+
- Add Gated dispute kit with support a dynamic token address for the Gated dispute kit using the dispute `extraData` ([#2045](https://github.com/kleros/kleros-v2/issues/2045))
52+
- Add Shutter Gated dispute kit ([#2045](https://github.com/kleros/kleros-v2/issues/2045))
53+
- Add public functions to `SortitionModuleBase` `getJurorLeftoverPNK(address _juror)` and `withdrawLeftoverPNK(address _account)` ([#2004](https://github.com/kleros/kleros-v2/issues/2004))
54+
- Add a permissioned function to KlerosCoreBase `transferBySortitionModule(address _account, uint256 _amount)`
55+
- Add a public boolean `DisputeKitBase.coreDisputeIDToActive` keyed by `coreDisputeID` ([#2039](https://github.com/kleros/kleros-v2/issues/2039))
56+
- Support for the Shutter API token by the keeper bot using the environment variable `SHUTTER_API_KEY` ([`f999611`](https://github.com/kleros/kleros-v2/commit/f999611))
57+
58+
### Removed
59+
60+
- Remove instant staking logic ([#2004](https://github.com/kleros/kleros-v2/issues/2004))
61+
- Remove the parameter `_alreadyTransferred` to the staking functions. No external interfaces impact. ([#2004](https://github.com/kleros/kleros-v2/issues/2004))
62+
63+
### Fixed
64+
65+
- Do not prevent a juror from being drawn if their entire stake is already locked ([#2004](https://github.com/kleros/kleros-v2/issues/2004))
66+
- Prevent stake corruption when delayed stakes move existing stakes to another court and juror is drawn ([#2004](https://github.com/kleros/kleros-v2/issues/2004))
67+
- Ensure that a dispute does belong to the right dispute kit ([#2039](https://github.com/kleros/kleros-v2/issues/2039))
68+
- Reset `dispute.jumped` in dispute kit `createDispute()` ([#2039](https://github.com/kleros/kleros-v2/issues/2039))
69+
70+
## [0.9.4] - 2025-06-23
71+
72+
### Changed
73+
74+
- Upgrade the Beta contracts ([`a72c450`](https://github.com/kleros/kleros-v2/commit/a72c450))
75+
- Upgrade the Testnet contracts ([`05c5b3d`](https://github.com/kleros/kleros-v2/commit/05c5b3d))
76+
- Upgrade the Devnet contracts ([`019cfd9`](https://github.com/kleros/kleros-v2/commit/019cfd9))
77+
78+
### Added
79+
80+
- Add a view function `KlerosCoreBase.getPnkAtStakePerJuror(uint256 _disputeID, uint256 _round)`
81+
- Add a public boolean `DisputeKitBase.alreadyDrawn` keyed by `localDisputeID`, `localRoundID` and `drawnAddress`
82+
83+
### Fixed
84+
85+
- Stop calling `getRoundInfo()` from the mutating function `DisputeKitBase._postDrawCheck()` ([`524a2dc`](https://github.com/kleros/kleros-v2/commit/524a2dc))
86+
- Restore the broken dispute kit storage layout on Testnet ([`1d2e62a`](https://github.com/kleros/kleros-v2/commit/1d2e62a))
87+
- Fix a typo in SafeERC20.sol ([#1960](https://github.com/kleros/kleros-v2/issues/1960))
88+
89+
### Uncategorized
90+
91+
## [0.9.3] - 2025-04-18
92+
93+
### Changed
94+
95+
- **Breaking change**: Bundle the package for both CJS and ESM, it changes the package entry point ([`c132303`](https://github.com/kleros/kleros-v2/commit/c132303))
96+
- Pass the commit and appeal periods quicker when possible ([#1955](https://github.com/kleros/kleros-v2/issues/1955))
97+
98+
### Added
99+
100+
- Add contracts getter for Viem ([`1aeb0a2`](https://github.com/kleros/kleros-v2/commit/1aeb0a2))
101+
- Add contract getter for EtherJS, export deployment files ([`692c83f`](https://github.com/kleros/kleros-v2/commit/692c83f))
102+
- New DisputeKitBase view function `isAppealFunded()` ([#1955](https://github.com/kleros/kleros-v2/issues/1955))
103+
104+
### Fixed
105+
106+
- Fix typo in custom error `StakingNotPossibleInThisCourt` ([#1956](https://github.com/kleros/kleros-v2/issues/1956))
107+
108+
## [0.8.1] - 2025-04-10
109+
110+
[0.11.0]: https://github.com/kleros/kleros-v2/releases/tag/@kleros%2Fkleros-v2-contracts@0.11.0
111+
[0.10.0]: https://github.com/kleros/kleros-v2/releases/tag/@kleros%2Fkleros-v2-contracts@0.10.0
112+
[0.9.4]: https://github.com/kleros/kleros-v2/releases/tag/@kleros%2Fkleros-v2-contracts@0.9.4
113+
[0.9.3]: https://github.com/kleros/kleros-v2/releases/tag/@kleros%2Fkleros-v2-contracts@0.9.3
114+
[0.8.1]: https://github.com/kleros/kleros-v2/releases/tag/@kleros%2Fkleros-v2-contracts@0.8.1

contracts/DEVNET_REDEPLOY.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
## Clean up of the old artifacts
2+
3+
The following contracts have been preserved:
4+
5+
- The University contracts (out-of-scope for now)
6+
- The ERC20 tokens and their faucets (unchanged): PinakionV2, PNK, PNKFaucet, DAI, DAIFaucet, WETH, WETHFaucet
7+
- The RNG contracts (unchanged): RandomizerOracle, BlockHashRNG, ChainlinkRNG, ChainlinkVRFCoordinator (mock)
8+
- KlerosV2NeoEarlyUser (unchanged, for Neo devnet)
9+
10+
```shell
11+
rm deployments/arbitrumSepoliaDevnet/DisputeKitClassic.json
12+
rm deployments/arbitrumSepoliaDevnet/DisputeKitClassic_Implementation.json
13+
rm deployments/arbitrumSepoliaDevnet/DisputeKitClassic_Proxy.json
14+
rm deployments/arbitrumSepoliaDevnet/DisputeKitGated_Implementation.json
15+
rm deployments/arbitrumSepoliaDevnet/DisputeKitGated_Proxy.json
16+
rm deployments/arbitrumSepoliaDevnet/DisputeKitGated.json
17+
rm deployments/arbitrumSepoliaDevnet/DisputeKitGatedShutter_Implementation.json
18+
rm deployments/arbitrumSepoliaDevnet/DisputeKitGatedShutter_Proxy.json
19+
rm deployments/arbitrumSepoliaDevnet/DisputeKitGatedShutter.json
20+
rm deployments/arbitrumSepoliaDevnet/DisputeKitShutter.json
21+
rm deployments/arbitrumSepoliaDevnet/DisputeKitShutter_Implementation.json
22+
rm deployments/arbitrumSepoliaDevnet/DisputeKitShutter_Proxy.json
23+
rm deployments/arbitrumSepoliaDevnet/DisputeResolver.json
24+
rm deployments/arbitrumSepoliaDevnet/DisputeResolverRuler.json
25+
rm deployments/arbitrumSepoliaDevnet/DisputeTemplateRegistry.json
26+
rm deployments/arbitrumSepoliaDevnet/DisputeTemplateRegistry_Implementation.json
27+
rm deployments/arbitrumSepoliaDevnet/DisputeTemplateRegistry_Proxy.json
28+
rm deployments/arbitrumSepoliaDevnet/EvidenceModule.json
29+
rm deployments/arbitrumSepoliaDevnet/EvidenceModule_Implementation.json
30+
rm deployments/arbitrumSepoliaDevnet/EvidenceModule_Proxy.json
31+
rm deployments/arbitrumSepoliaDevnet/KlerosCore.json
32+
rm deployments/arbitrumSepoliaDevnet/KlerosCoreRuler.json
33+
rm deployments/arbitrumSepoliaDevnet/KlerosCoreRuler_Implementation.json
34+
rm deployments/arbitrumSepoliaDevnet/KlerosCoreRuler_Proxy.json
35+
rm deployments/arbitrumSepoliaDevnet/KlerosCoreSnapshotProxy.json
36+
rm deployments/arbitrumSepoliaDevnet/KlerosCore_Implementation.json
37+
rm deployments/arbitrumSepoliaDevnet/KlerosCore_Proxy.json
38+
rm deployments/arbitrumSepoliaDevnet/PolicyRegistry.json
39+
rm deployments/arbitrumSepoliaDevnet/PolicyRegistry_Implementation.json
40+
rm deployments/arbitrumSepoliaDevnet/PolicyRegistry_Proxy.json
41+
rm deployments/arbitrumSepoliaDevnet/SortitionModule.json
42+
rm deployments/arbitrumSepoliaDevnet/SortitionModule_Implementation.json
43+
rm deployments/arbitrumSepoliaDevnet/SortitionModule_Proxy.json
44+
```
45+
46+
## Contracts Deployment - DRY RUN
47+
48+
Shell 1: fork node
49+
50+
```shell
51+
anvil --fork-url https://sepolia-rollup.arbitrum.io/rpc
52+
```
53+
54+
Shell 2: deployer
55+
56+
```shell
57+
export ARBITRUM_SEPOLIA_RPC=http://127.0.0.1:8545
58+
59+
yarn clean
60+
yarn deploy --network arbitrumSepoliaDevnet --tags Resolver
61+
yarn deploy --network arbitrumSepoliaDevnet --tags ArbitrationRuler
62+
63+
unset ARBITRUM_SEPOLIA_RPC
64+
```
65+
66+
:warning: Remember to delete all the deployed artifacts after each dry run.
67+
68+
## Contracts Deployment - LIVE
69+
70+
```shell
71+
yarn clean
72+
yarn deploy --network arbitrumSepoliaDevnet --tags Resolver
73+
yarn deploy --network arbitrumSepoliaDevnet --tags ArbitrationRuler
74+
75+
# Contracts verification, marking proxies
76+
yarn etherscan-verify --network arbitrumSepoliaDevnet
77+
yarn etherscan-verify-proxies
78+
79+
# Docs update
80+
./scripts/populateReadme.sh
81+
```
82+
83+
## Courts structure and policies configuration
84+
85+
```shell
86+
yarn hardhat populate:courts --from v2_devnet --network arbitrumSepoliaDevnet
87+
88+
yarn hardhat populate:policy-registry --from v2_devnet --network arbitrumSepoliaDevnet
89+
```
90+
91+
## Contracts SDK
92+
93+
### Refresh the artifacts
94+
95+
```shell
96+
# Viem artifacts
97+
yarn viem:generate-devnet
98+
99+
# Hardhat artifacts
100+
yarn export:devnet
101+
```
102+
103+
### Update the contract helpers
104+
105+
If there are new or removed contracts, edit the contract helpers in:
106+
107+
- `scripts/utils/contracts.ts` (Hardhat runtime)
108+
- `deployments/contractsEthers.ts` (pure EthersJS)
109+
- `deployments/contractsViem.ts` (pure Viem)

0 commit comments

Comments
 (0)