Skip to content

Commit ce24e73

Browse files
committed
chore: deployment of new dispute kit to fix #1148
1 parent d9adb8f commit ce24e73

File tree

2 files changed

+70
-64
lines changed

2 files changed

+70
-64
lines changed

contracts/deploy/fix1148.ts

+18-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { HardhatRuntimeEnvironment } from "hardhat/types";
22
import { DeployFunction } from "hardhat-deploy/types";
3-
import { DisputeKitClassic, KlerosCore } from "../typechain-types";
3+
import { DisputeKitClassic, KlerosCore, SortitionModule } from "../typechain-types";
44
import assert from "node:assert";
55

66
enum HomeChains {
@@ -10,31 +10,32 @@ enum HomeChains {
1010
}
1111

1212
const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
13-
const { deployments, getNamedAccounts, getChainId } = hre;
13+
const { ethers, deployments, getNamedAccounts, getChainId } = hre;
1414
const { deploy, execute } = deployments;
15-
const { AddressZero } = hre.ethers.constants;
15+
const { AddressZero } = ethers.constants;
1616

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

22-
const oldDisputeKitId = 1;
23-
const newDisputeKitId = 2;
24-
25-
const klerosCore = (await hre.ethers.getContract("KlerosCore")) as KlerosCore;
26-
const oldDisputeKit = (await hre.ethers.getContract("DisputeKitClassic")) as DisputeKitClassic;
22+
const klerosCore = (await ethers.getContract("KlerosCore")) as KlerosCore;
23+
const oldDisputeKit = (await ethers.getContract("DisputeKitClassic")) as DisputeKitClassic;
2724

2825
await deploy("DisputeKitClassic", {
2926
from: deployer,
3027
args: [deployer, AddressZero],
3128
log: true,
3229
});
3330

34-
const newDisputeKit = (await hre.ethers.getContract("DisputeKitClassic")) as DisputeKitClassic;
31+
const newDisputeKit = (await ethers.getContract("DisputeKitClassic")) as DisputeKitClassic;
3532

33+
await execute("DisputeKitClassic", { from: deployer, log: true }, "changeCore", klerosCore.address);
3634
await execute("KlerosCore", { from: deployer, log: true }, "addNewDisputeKit", newDisputeKit.address, 0);
3735

36+
const oldDisputeKitId = 1;
37+
const newDisputeKitId = 2;
38+
3839
assert(
3940
await klerosCore.disputeKitNodes(oldDisputeKitId).then((node) => node.disputeKit === oldDisputeKit.address),
4041
`wrong dispute kit id ${oldDisputeKitId}`
@@ -44,8 +45,13 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
4445
`wrong dispute kit id ${newDisputeKitId}`
4546
);
4647

47-
await execute("KlerosCore", { from: deployer, log: true }, "enableDisputeKits", 1, newDisputeKitId, true); // enable the new dispute kit
48-
await execute("KlerosCore", { from: deployer, log: true }, "enableDisputeKits", 1, oldDisputeKitId, false); // disable the old dispute kit
48+
await execute("KlerosCore", { from: deployer, log: true }, "enableDisputeKits", 1, [newDisputeKitId], true); // enable the new dispute kit in court 1
49+
await execute("KlerosCore", { from: deployer, log: true }, "enableDisputeKits", 2, [newDisputeKitId], true); // enable the new dispute kit in court 2
50+
await execute("KlerosCore", { from: deployer, log: true }, "enableDisputeKits", 3, [newDisputeKitId], true); // enable the new dispute kit in court 3
51+
52+
// Cannot disable the old DK because of https://github.com/kleros/kleros-v2/blob/d9adb8f54e8164eb01880296b4dd62b74cad3a0e/contracts/src/arbitration/KlerosCore.sol#L452
53+
// Does not seem correct
54+
//await execute("KlerosCore", { from: deployer, log: true }, "enableDisputeKits", 1, [oldDisputeKitId], false); // disable the old dispute kit
4955
};
5056

5157
deployArbitration.tags = ["Fix1148"];

contracts/deployments/arbitrumGoerli/DisputeKitClassic.json

+52-52
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)