Skip to content

Commit be6d5f9

Browse files
authored
Merge pull request #1845 from kleros/dev
Release v2-testnet-4.0.6
2 parents e750d66 + 386da9f commit be6d5f9

File tree

85 files changed

+2010
-1726
lines changed

Some content is hidden

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

85 files changed

+2010
-1726
lines changed

.codeclimate.yml

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
checks:
2+
similar_code:
3+
exclude_paths:
4+
- "contracts/tests/"
5+
complexity:
6+
exclude_paths:
7+
- "contracts/tests/"
18
engines:
29
tslint:
310
enabled: true
@@ -7,3 +14,5 @@ engines:
714
exclude_paths:
815
- "web/src/graphql/generated.ts"
916
- "contracts/deployments/"
17+
- "contracts/config/"
18+
- "kleros-sdk/config/"
+54-19
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,82 @@
11
[
22
{
3+
"name": "General Court",
34
"id": 1,
45
"parent": 0,
56
"hiddenVotes": true,
6-
"minStake": "520000000000000000000",
7+
"minStake": "1500000000000000000",
78
"alpha": "5000",
8-
"feeForJuror": "15000000000000000000",
9+
"feeForJuror": "100000000000",
910
"jurorsForCourtJump": "511",
1011
"timesPerPeriod": [
11-
280800,
12-
583200,
13-
583200,
14-
388800
12+
120,
13+
240,
14+
240,
15+
600
1516
]
1617
},
1718
{
19+
"name": "Curation",
1820
"id": 2,
1921
"parent": 1,
2022
"hiddenVotes": false,
21-
"minStake": "520000000000000000000",
23+
"minStake": "2000000000000000000",
2224
"alpha": "3100",
23-
"feeForJuror": "6900000000000000000",
24-
"jurorsForCourtJump": "30",
25+
"feeForJuror": "100000000000",
26+
"jurorsForCourtJump": "31",
2527
"timesPerPeriod": [
26-
140400,
27-
291600,
28-
291600,
29-
194400
28+
120,
29+
240,
30+
240,
31+
600
3032
]
3133
},
3234
{
35+
"name": "English Language",
3336
"id": 3,
3437
"parent": 1,
3538
"hiddenVotes": false,
36-
"minStake": "1200000000000000000000",
39+
"minStake": "2000000000000000000",
3740
"alpha": "5000",
38-
"feeForJuror": "22000000000000000000",
41+
"feeForJuror": "100000000000",
3942
"jurorsForCourtJump": "63",
4043
"timesPerPeriod": [
41-
280800,
42-
437400,
43-
437400,
44-
291600
44+
120,
45+
240,
46+
240,
47+
600
48+
]
49+
},
50+
{
51+
"name": "Corte de Disputas de Consumo y Vecindad",
52+
"id": 4,
53+
"parent": 1,
54+
"hiddenVotes": false,
55+
"minStake": "2000000000000000000",
56+
"alpha": "5000",
57+
"feeForJuror": "100000000000",
58+
"jurorsForCourtJump": "63",
59+
"timesPerPeriod": [
60+
120,
61+
240,
62+
240,
63+
600
64+
]
65+
},
66+
{
67+
"name": "Oracle Court",
68+
"id": 5,
69+
"parent": 1,
70+
"hiddenVotes": false,
71+
"minStake": "2000000000000000000",
72+
"alpha": "5000",
73+
"feeForJuror": "100000000000",
74+
"jurorsForCourtJump": "31",
75+
"timesPerPeriod": [
76+
120,
77+
240,
78+
240,
79+
600
4580
]
4681
}
4782
]

contracts/config/courts.v2.mainnet-neo.json

+17-1
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@
448448
]
449449
},
450450
{
451-
"name": "Blockchain No Técnica",
451+
"name": "Corte de Disputas de Consumo y Vecindad",
452452
"id": 29,
453453
"parent": 23,
454454
"hiddenVotes": false,
@@ -462,5 +462,21 @@
462462
216000,
463463
216000
464464
]
465+
},
466+
{
467+
"name": "Oracle Court",
468+
"id": 30,
469+
"parent": 1,
470+
"hiddenVotes": false,
471+
"minStake": "5000000000000000000000",
472+
"feeForJuror": "6900000000000000",
473+
"alpha": "5000",
474+
"jurorsForCourtJump": "31",
475+
"timesPerPeriod": [
476+
280800,
477+
583200,
478+
583200,
479+
388800
480+
]
465481
}
466482
]

contracts/config/courts.v2.testnet.json

+36-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[
22
{
3+
"name": "General Court",
34
"id": 1,
45
"parent": 0,
56
"hiddenVotes": true,
@@ -15,13 +16,14 @@
1516
]
1617
},
1718
{
19+
"name": "Curation",
1820
"id": 2,
1921
"parent": 1,
2022
"hiddenVotes": false,
2123
"minStake": "200000000000000000000",
2224
"alpha": "3100",
2325
"feeForJuror": "10000000000000",
24-
"jurorsForCourtJump": "30",
26+
"jurorsForCourtJump": "31",
2527
"timesPerPeriod": [
2628
43200,
2729
43200,
@@ -30,6 +32,7 @@
3032
]
3133
},
3234
{
35+
"name": "English Language",
3336
"id": 3,
3437
"parent": 1,
3538
"hiddenVotes": false,
@@ -43,5 +46,37 @@
4346
43200,
4447
43200
4548
]
49+
},
50+
{
51+
"name": "Corte de Disputas de Consumo y Vecindad",
52+
"id": 4,
53+
"parent": 1,
54+
"hiddenVotes": false,
55+
"minStake": "200000000000000000000",
56+
"alpha": "5000",
57+
"feeForJuror": "10000000000000",
58+
"jurorsForCourtJump": "63",
59+
"timesPerPeriod": [
60+
43200,
61+
43200,
62+
43200,
63+
43200
64+
]
65+
},
66+
{
67+
"name": "Oracle Court",
68+
"id": 5,
69+
"parent": 1,
70+
"hiddenVotes": false,
71+
"minStake": "200000000000000000000",
72+
"alpha": "5000",
73+
"feeForJuror": "10000000000000",
74+
"jurorsForCourtJump": "31",
75+
"timesPerPeriod": [
76+
43200,
77+
43200,
78+
43200,
79+
43200
80+
]
4681
}
4782
]

contracts/config/policies.v2.devnet.json

+25-9
Large diffs are not rendered by default.

contracts/config/policies.v2.mainnet-neo.json

+103-95
Large diffs are not rendered by default.

contracts/config/policies.v2.testnet.json

+25-9
Large diffs are not rendered by default.

contracts/config/policies.v2/Curation-Court-Policy.json

-6
This file was deleted.

contracts/config/policies.v2/English-Language-Court-Policy.json

-6
This file was deleted.

contracts/config/policies.v2/General-Court-Policy.json

-5
This file was deleted.

contracts/deploy/00-home-chain-arbitration-neo.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
7373
deployer,
7474
deployer,
7575
pnk.target,
76-
ZeroAddress, // KlerosCore is configured later
76+
ZeroAddress, // jurorProsecutionModule is not implemented yet
7777
disputeKit.address,
7878
false,
7979
[minStake, alpha, feeForJuror, jurorsForCourtJump],
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { HardhatRuntimeEnvironment } from "hardhat/types";
2+
import { DeployFunction } from "hardhat-deploy/types";
3+
import { deployUpgradable } from "./utils/deployUpgradable";
4+
import { HomeChains, isSkipped } from "./utils";
5+
6+
const deployUpgradeDisputeKit: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
7+
const { deployments, getNamedAccounts, getChainId } = hre;
8+
9+
// fallback to hardhat node signers on local network
10+
const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address;
11+
const chainId = Number(await getChainId());
12+
console.log("upgrading on %s with deployer %s", HomeChains[chainId], deployer);
13+
14+
try {
15+
console.log("upgrading DisputeKitClassicNeo...");
16+
await deployUpgradable(deployments, "DisputeKitClassicNeo", {
17+
contract: "DisputeKitClassic",
18+
initializer: "initialize",
19+
from: deployer,
20+
// Warning: do not reinitialize everything, only the new variables
21+
args: [],
22+
});
23+
} catch (err) {
24+
console.error(err);
25+
throw err;
26+
}
27+
};
28+
29+
deployUpgradeDisputeKit.tags = ["Upgrade", "DisputeKit"];
30+
deployUpgradeDisputeKit.skip = async ({ network }) => {
31+
return isSkipped(network, !HomeChains[network.config.chainId ?? 0]);
32+
};
33+
34+
export default deployUpgradeDisputeKit;

contracts/deploy/upgrade-kleros-core.ts

+8-23
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,21 @@ import { deployUpgradable } from "./utils/deployUpgradable";
44
import { HomeChains, isSkipped } from "./utils";
55

66
const deployUpgradeKlerosCore: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
7-
const { ethers, deployments, getNamedAccounts, getChainId } = hre;
8-
const { ZeroAddress } = hre.ethers;
7+
const { deployments, getNamedAccounts, getChainId } = hre;
98

109
// fallback to hardhat node signers on local network
1110
const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address;
1211
const chainId = Number(await getChainId());
13-
console.log("upgrading to %s with deployer %s", HomeChains[chainId], deployer);
12+
console.log("upgrading on %s with deployer %s", HomeChains[chainId], deployer);
1413

1514
try {
16-
const pnk = await deployments.get("PNK");
17-
const disputeKit = await deployments.get("DisputeKitClassic");
18-
const minStake = 2n * 10n ** 20n;
19-
const alpha = 10000;
20-
const feeForJuror = 10n * 17n;
21-
const sortitionModule = await deployments.get("SortitionModule");
22-
23-
console.log("upgrading the KlerosCore...");
24-
await deployUpgradable(deployments, "KlerosCore", {
15+
console.log("upgrading KlerosCoreNeo...");
16+
await deployUpgradable(deployments, "KlerosCoreNeo", {
17+
newImplementation: "KlerosCoreNeo",
18+
initializer: "initialize",
2519
from: deployer,
26-
args: [
27-
deployer,
28-
pnk,
29-
ZeroAddress,
30-
disputeKit.address,
31-
false,
32-
[minStake, alpha, feeForJuror, 256], // minStake, alpha, feeForJuror, jurorsForCourtJump
33-
[0, 0, 0, 10], // evidencePeriod, commitPeriod, votePeriod, appealPeriod
34-
ethers.toBeHex(5), // Extra data for sortition module will return the default value of K
35-
sortitionModule.address,
36-
],
20+
// Warning: do not reinitialize everything, only the new variables
21+
args: [],
3722
});
3823
} catch (err) {
3924
console.error(err);

contracts/deploy/upgrade-sortition-module.ts

+7-16
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,20 @@ import { HomeChains, isSkipped } from "./utils";
55

66
const deployUpgradeSortitionModule: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
77
const { deployments, getNamedAccounts, getChainId } = hre;
8-
const RNG_LOOKAHEAD = 20;
98

109
// fallback to hardhat node signers on local network
1110
const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address;
1211
const chainId = Number(await getChainId());
13-
console.log("upgrading to %s with deployer %s", HomeChains[chainId], deployer);
12+
console.log("upgrading on %s with deployer %s", HomeChains[chainId], deployer);
1413

1514
try {
16-
const rng = await deployments.get("RandomizerRNG");
17-
const klerosCore = await deployments.get("KlerosCore");
18-
const klerosCoreAddress = klerosCore.address;
19-
20-
console.log("upgrading the SortitionModule...");
21-
await deployUpgradable(deployments, "SortitionModule", {
15+
console.log("upgrading SortitionModuleNeo...");
16+
await deployUpgradable(deployments, "SortitionModuleNeo", {
17+
newImplementation: "SortitionModuleNeo",
18+
initializer: "initialize",
2219
from: deployer,
23-
args: [
24-
deployer,
25-
klerosCoreAddress,
26-
1800, // minStakingTime
27-
1800, // maxFreezingTime
28-
rng.address,
29-
RNG_LOOKAHEAD,
30-
],
20+
// Warning: do not reinitialize everything, only the new variables
21+
args: [],
3122
});
3223
} catch (err) {
3324
console.error(err);

contracts/hardhat.config.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const config: HardhatUserConfig = {
9595
// Home chain ---------------------------------------------------------------------------------
9696
arbitrumSepolia: {
9797
chainId: 421614,
98-
url: process.env.ARBITRUM_SEPOLIA_RPC ?? "https://sepolia-rollup.arbitrum.io/rpc",
98+
url: process.env.ARBITRUM_SEPOLIA_RPC ?? `https://arbitrum-sepolia.infura.io/v3/${process.env.INFURA_API_KEY}`,
9999
accounts:
100100
(process.env.ARB_GOERLI_PRIVATE_KEY_WALLET_1 && [
101101
process.env.ARB_GOERLI_PRIVATE_KEY_WALLET_1 as string,
@@ -121,7 +121,7 @@ const config: HardhatUserConfig = {
121121
},
122122
arbitrumSepoliaDevnet: {
123123
chainId: 421614,
124-
url: process.env.ARBITRUM_SEPOLIA_RPC ?? "https://sepolia-rollup.arbitrum.io/rpc",
124+
url: process.env.ARBITRUM_SEPOLIA_RPC ?? `https://arbitrum-sepolia.infura.io/v3/${process.env.INFURA_API_KEY}`,
125125
accounts:
126126
(process.env.ARB_GOERLI_PRIVATE_KEY_WALLET_1 && [
127127
process.env.ARB_GOERLI_PRIVATE_KEY_WALLET_1 as string,
@@ -147,7 +147,7 @@ const config: HardhatUserConfig = {
147147
},
148148
arbitrum: {
149149
chainId: 42161,
150-
url: "https://arb1.arbitrum.io/rpc",
150+
url: process.env.ARBITRUM_RPC ?? `https://arbitrum-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`,
151151
accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
152152
live: true,
153153
saveDeployments: true,

0 commit comments

Comments
 (0)