Skip to content

Commit

Permalink
Merge pull request #1845 from kleros/dev
Browse files Browse the repository at this point in the history
Release v2-testnet-4.0.6
  • Loading branch information
jaybuidl authored Jan 27, 2025
2 parents e750d66 + 386da9f commit be6d5f9
Show file tree
Hide file tree
Showing 85 changed files with 2,010 additions and 1,726 deletions.
9 changes: 9 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
checks:
similar_code:
exclude_paths:
- "contracts/tests/"
complexity:
exclude_paths:
- "contracts/tests/"
engines:
tslint:
enabled: true
Expand All @@ -7,3 +14,5 @@ engines:
exclude_paths:
- "web/src/graphql/generated.ts"
- "contracts/deployments/"
- "contracts/config/"
- "kleros-sdk/config/"
73 changes: 54 additions & 19 deletions contracts/config/courts.v2.devnet.json
Original file line number Diff line number Diff line change
@@ -1,47 +1,82 @@
[
{
"name": "General Court",
"id": 1,
"parent": 0,
"hiddenVotes": true,
"minStake": "520000000000000000000",
"minStake": "1500000000000000000",
"alpha": "5000",
"feeForJuror": "15000000000000000000",
"feeForJuror": "100000000000",
"jurorsForCourtJump": "511",
"timesPerPeriod": [
280800,
583200,
583200,
388800
120,
240,
240,
600
]
},
{
"name": "Curation",
"id": 2,
"parent": 1,
"hiddenVotes": false,
"minStake": "520000000000000000000",
"minStake": "2000000000000000000",
"alpha": "3100",
"feeForJuror": "6900000000000000000",
"jurorsForCourtJump": "30",
"feeForJuror": "100000000000",
"jurorsForCourtJump": "31",
"timesPerPeriod": [
140400,
291600,
291600,
194400
120,
240,
240,
600
]
},
{
"name": "English Language",
"id": 3,
"parent": 1,
"hiddenVotes": false,
"minStake": "1200000000000000000000",
"minStake": "2000000000000000000",
"alpha": "5000",
"feeForJuror": "22000000000000000000",
"feeForJuror": "100000000000",
"jurorsForCourtJump": "63",
"timesPerPeriod": [
280800,
437400,
437400,
291600
120,
240,
240,
600
]
},
{
"name": "Corte de Disputas de Consumo y Vecindad",
"id": 4,
"parent": 1,
"hiddenVotes": false,
"minStake": "2000000000000000000",
"alpha": "5000",
"feeForJuror": "100000000000",
"jurorsForCourtJump": "63",
"timesPerPeriod": [
120,
240,
240,
600
]
},
{
"name": "Oracle Court",
"id": 5,
"parent": 1,
"hiddenVotes": false,
"minStake": "2000000000000000000",
"alpha": "5000",
"feeForJuror": "100000000000",
"jurorsForCourtJump": "31",
"timesPerPeriod": [
120,
240,
240,
600
]
}
]
18 changes: 17 additions & 1 deletion contracts/config/courts.v2.mainnet-neo.json
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@
]
},
{
"name": "Blockchain No Técnica",
"name": "Corte de Disputas de Consumo y Vecindad",
"id": 29,
"parent": 23,
"hiddenVotes": false,
Expand All @@ -462,5 +462,21 @@
216000,
216000
]
},
{
"name": "Oracle Court",
"id": 30,
"parent": 1,
"hiddenVotes": false,
"minStake": "5000000000000000000000",
"feeForJuror": "6900000000000000",
"alpha": "5000",
"jurorsForCourtJump": "31",
"timesPerPeriod": [
280800,
583200,
583200,
388800
]
}
]
37 changes: 36 additions & 1 deletion contracts/config/courts.v2.testnet.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[
{
"name": "General Court",
"id": 1,
"parent": 0,
"hiddenVotes": true,
Expand All @@ -15,13 +16,14 @@
]
},
{
"name": "Curation",
"id": 2,
"parent": 1,
"hiddenVotes": false,
"minStake": "200000000000000000000",
"alpha": "3100",
"feeForJuror": "10000000000000",
"jurorsForCourtJump": "30",
"jurorsForCourtJump": "31",
"timesPerPeriod": [
43200,
43200,
Expand All @@ -30,6 +32,7 @@
]
},
{
"name": "English Language",
"id": 3,
"parent": 1,
"hiddenVotes": false,
Expand All @@ -43,5 +46,37 @@
43200,
43200
]
},
{
"name": "Corte de Disputas de Consumo y Vecindad",
"id": 4,
"parent": 1,
"hiddenVotes": false,
"minStake": "200000000000000000000",
"alpha": "5000",
"feeForJuror": "10000000000000",
"jurorsForCourtJump": "63",
"timesPerPeriod": [
43200,
43200,
43200,
43200
]
},
{
"name": "Oracle Court",
"id": 5,
"parent": 1,
"hiddenVotes": false,
"minStake": "200000000000000000000",
"alpha": "5000",
"feeForJuror": "10000000000000",
"jurorsForCourtJump": "31",
"timesPerPeriod": [
43200,
43200,
43200,
43200
]
}
]
34 changes: 25 additions & 9 deletions contracts/config/policies.v2.devnet.json

Large diffs are not rendered by default.

198 changes: 103 additions & 95 deletions contracts/config/policies.v2.mainnet-neo.json

Large diffs are not rendered by default.

34 changes: 25 additions & 9 deletions contracts/config/policies.v2.testnet.json

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions contracts/config/policies.v2/Curation-Court-Policy.json

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions contracts/config/policies.v2/General-Court-Policy.json

This file was deleted.

2 changes: 1 addition & 1 deletion contracts/deploy/00-home-chain-arbitration-neo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
deployer,
deployer,
pnk.target,
ZeroAddress, // KlerosCore is configured later
ZeroAddress, // jurorProsecutionModule is not implemented yet
disputeKit.address,
false,
[minStake, alpha, feeForJuror, jurorsForCourtJump],
Expand Down
34 changes: 34 additions & 0 deletions contracts/deploy/upgrade-dispute-kit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import { deployUpgradable } from "./utils/deployUpgradable";
import { HomeChains, isSkipped } from "./utils";

const deployUpgradeDisputeKit: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deployments, getNamedAccounts, getChainId } = hre;

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

try {
console.log("upgrading DisputeKitClassicNeo...");
await deployUpgradable(deployments, "DisputeKitClassicNeo", {
contract: "DisputeKitClassic",
initializer: "initialize",
from: deployer,
// Warning: do not reinitialize everything, only the new variables
args: [],
});
} catch (err) {
console.error(err);
throw err;
}
};

deployUpgradeDisputeKit.tags = ["Upgrade", "DisputeKit"];
deployUpgradeDisputeKit.skip = async ({ network }) => {
return isSkipped(network, !HomeChains[network.config.chainId ?? 0]);
};

export default deployUpgradeDisputeKit;
31 changes: 8 additions & 23 deletions contracts/deploy/upgrade-kleros-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,21 @@ import { deployUpgradable } from "./utils/deployUpgradable";
import { HomeChains, isSkipped } from "./utils";

const deployUpgradeKlerosCore: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { ethers, deployments, getNamedAccounts, getChainId } = hre;
const { ZeroAddress } = hre.ethers;
const { deployments, getNamedAccounts, getChainId } = hre;

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

try {
const pnk = await deployments.get("PNK");
const disputeKit = await deployments.get("DisputeKitClassic");
const minStake = 2n * 10n ** 20n;
const alpha = 10000;
const feeForJuror = 10n * 17n;
const sortitionModule = await deployments.get("SortitionModule");

console.log("upgrading the KlerosCore...");
await deployUpgradable(deployments, "KlerosCore", {
console.log("upgrading KlerosCoreNeo...");
await deployUpgradable(deployments, "KlerosCoreNeo", {
newImplementation: "KlerosCoreNeo",
initializer: "initialize",
from: deployer,
args: [
deployer,
pnk,
ZeroAddress,
disputeKit.address,
false,
[minStake, alpha, feeForJuror, 256], // minStake, alpha, feeForJuror, jurorsForCourtJump
[0, 0, 0, 10], // evidencePeriod, commitPeriod, votePeriod, appealPeriod
ethers.toBeHex(5), // Extra data for sortition module will return the default value of K
sortitionModule.address,
],
// Warning: do not reinitialize everything, only the new variables
args: [],
});
} catch (err) {
console.error(err);
Expand Down
23 changes: 7 additions & 16 deletions contracts/deploy/upgrade-sortition-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,20 @@ import { HomeChains, isSkipped } from "./utils";

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

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

try {
const rng = await deployments.get("RandomizerRNG");
const klerosCore = await deployments.get("KlerosCore");
const klerosCoreAddress = klerosCore.address;

console.log("upgrading the SortitionModule...");
await deployUpgradable(deployments, "SortitionModule", {
console.log("upgrading SortitionModuleNeo...");
await deployUpgradable(deployments, "SortitionModuleNeo", {
newImplementation: "SortitionModuleNeo",
initializer: "initialize",
from: deployer,
args: [
deployer,
klerosCoreAddress,
1800, // minStakingTime
1800, // maxFreezingTime
rng.address,
RNG_LOOKAHEAD,
],
// Warning: do not reinitialize everything, only the new variables
args: [],
});
} catch (err) {
console.error(err);
Expand Down
6 changes: 3 additions & 3 deletions contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const config: HardhatUserConfig = {
// Home chain ---------------------------------------------------------------------------------
arbitrumSepolia: {
chainId: 421614,
url: process.env.ARBITRUM_SEPOLIA_RPC ?? "https://sepolia-rollup.arbitrum.io/rpc",
url: process.env.ARBITRUM_SEPOLIA_RPC ?? `https://arbitrum-sepolia.infura.io/v3/${process.env.INFURA_API_KEY}`,
accounts:
(process.env.ARB_GOERLI_PRIVATE_KEY_WALLET_1 && [
process.env.ARB_GOERLI_PRIVATE_KEY_WALLET_1 as string,
Expand All @@ -121,7 +121,7 @@ const config: HardhatUserConfig = {
},
arbitrumSepoliaDevnet: {
chainId: 421614,
url: process.env.ARBITRUM_SEPOLIA_RPC ?? "https://sepolia-rollup.arbitrum.io/rpc",
url: process.env.ARBITRUM_SEPOLIA_RPC ?? `https://arbitrum-sepolia.infura.io/v3/${process.env.INFURA_API_KEY}`,
accounts:
(process.env.ARB_GOERLI_PRIVATE_KEY_WALLET_1 && [
process.env.ARB_GOERLI_PRIVATE_KEY_WALLET_1 as string,
Expand All @@ -147,7 +147,7 @@ const config: HardhatUserConfig = {
},
arbitrum: {
chainId: 42161,
url: "https://arb1.arbitrum.io/rpc",
url: process.env.ARBITRUM_RPC ?? `https://arbitrum-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`,
accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
live: true,
saveDeployments: true,
Expand Down
Loading

0 comments on commit be6d5f9

Please sign in to comment.