Skip to content

Commit f84e4a9

Browse files
committed
fix(contracts): dispute resolver DisputeRequest event params, redeployed
1 parent e72bd47 commit f84e4a9

File tree

9 files changed

+183
-170
lines changed

9 files changed

+183
-170
lines changed

contracts/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Refresh the list of deployed contracts by running `./scripts/generateDeployments
1111
#### Arbitrum One
1212

1313
- [DisputeKitClassicNeo: proxy](https://arbiscan.io/address/0xb7c292cD9Fd3d20De84a71AE1caF054eEB6374A9), [implementation](https://arbiscan.io/address/0x86Ac67e5550F837a650B4B0Cd4778D4293a2bDe3)
14-
- [DisputeResolverNeo](https://arbiscan.io/address/0xE4066AE16685F66e30fb22e932B67E49220095c0)
14+
- [DisputeResolverNeo](https://arbiscan.io/address/0x3645F9e08D80E47c82aD9E33fCB4EA703822C831)
1515
- [DisputeTemplateRegistry: proxy](https://arbiscan.io/address/0x52c9f5634361eD3641016e5d9783310f9EFf9e25), [implementation](https://arbiscan.io/address/0x4Ce87329d40f15509D5F9bF4D9Ce1A081A80CeFb)
1616
- [EvidenceModule: proxy](https://arbiscan.io/address/0xe62B776498F48061ef9425fCEf30F3d1370DB005), [implementation](https://arbiscan.io/address/0x827411b3e98bAe8c441efBf26842A1670f8f378F)
1717
- [KlerosCoreNeo: proxy](https://arbiscan.io/address/0xCd415C03dfa85B02646C7e2977F22a480c4354F1), [implementation](https://arbiscan.io/address/0x4DD8B69958eF1D7d5dA9347E9d9F57ADFC3dc284)
@@ -73,10 +73,10 @@ Refresh the list of deployed contracts by running `./scripts/generateDeployments
7373
- [DisputeKitClassic: proxy](https://sepolia.arbiscan.io/address/0x9426F127116C3652A262AE1eA48391AC8F44D35b), [implementation](https://sepolia.arbiscan.io/address/0x692CC78F2570181FFB99297965FeAA8352ab12E8)
7474
- [DisputeKitClassicNeo: proxy](https://sepolia.arbiscan.io/address/0xd40aA608801a639E292e10C235B90488D04070b1), [implementation](https://sepolia.arbiscan.io/address/0xE636AB278fBfc8712E807c589A362dc2396d2d2F)
7575
- [DisputeKitClassicUniversity: proxy](https://sepolia.arbiscan.io/address/0xDaE66157D72Baa099cd63a833c353776206feea4), [implementation](https://sepolia.arbiscan.io/address/0xf36fa321Bb64b6E39f5DA3dbb053ccE63D077f8B)
76-
- [DisputeResolver](https://sepolia.arbiscan.io/address/0xAE92948F5534A6ABCC7ea16a5Cd1984cD305Aa6E)
77-
- [DisputeResolverNeo](https://sepolia.arbiscan.io/address/0x42776e45977C6C4e172e564102Ab01540555b368)
78-
- [DisputeResolverRuler](https://sepolia.arbiscan.io/address/0x2F34E49853EaDB3253C9453aBeE37d3fbA395F6B)
79-
- [DisputeResolverUniversity](https://sepolia.arbiscan.io/address/0x9e8F92708705D3571F29589E441bF52c9e5f8811)
76+
- [DisputeResolver](https://sepolia.arbiscan.io/address/0xCE3d5F83d9da70d60ab9cee8b644a18EF3671E61)
77+
- [DisputeResolverNeo](https://sepolia.arbiscan.io/address/0xB73B124f2939959676509c37Ab6a41C8Ab4aDA1C)
78+
- [DisputeResolverRuler](https://sepolia.arbiscan.io/address/0x199893232ECC74cC7898B24b5Ff58d613029f6B7)
79+
- [DisputeResolverUniversity](https://sepolia.arbiscan.io/address/0x88d793dA6e88Ebd58136A1e1483cc4cf0D915ca4)
8080
- [DisputeTemplateRegistry: proxy](https://sepolia.arbiscan.io/address/0x596D3B09E684D62217682216e9b7a0De75933391), [implementation](https://sepolia.arbiscan.io/address/0xE00A43d3c3321A0e210F2F8bE2F3F75eC8a4951E)
8181
- [EvidenceModule: proxy](https://sepolia.arbiscan.io/address/0x57fd453FB0d16f8ca174E7386102D7170E17Be09), [implementation](https://sepolia.arbiscan.io/address/0x05AD81f245209b7f91885fd96e57c9da90554824)
8282
- [KlerosCore: proxy](https://sepolia.arbiscan.io/address/0xA54e7A16d7460e38a8F324eF46782FB520d58CE8), [implementation](https://sepolia.arbiscan.io/address/0x91a373BBdE0532F86410682F362e2Cf685e95085)

contracts/deployments/arbitrum/DisputeResolverNeo.json

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

contracts/deployments/arbitrumSepoliaDevnet/DisputeResolver.json

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

contracts/deployments/arbitrumSepoliaDevnet/DisputeResolverNeo.json

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

contracts/deployments/arbitrumSepoliaDevnet/DisputeResolverRuler.json

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

contracts/deployments/arbitrumSepoliaDevnet/DisputeResolverUniversity.json

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

contracts/src/arbitration/arbitrables/DisputeResolver.sol

+4-4
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ contract DisputeResolver is IArbitrableV2 {
134134
string memory _disputeTemplateDataMappings,
135135
string memory _disputeTemplateUri,
136136
uint256 _numberOfRulingOptions
137-
) internal virtual returns (uint256 disputeID) {
137+
) internal virtual returns (uint256 arbitratorDisputeID) {
138138
require(_numberOfRulingOptions > 1, "Should be at least 2 ruling options.");
139139

140-
disputeID = arbitrator.createDispute{value: msg.value}(_numberOfRulingOptions, _arbitratorExtraData);
140+
arbitratorDisputeID = arbitrator.createDispute{value: msg.value}(_numberOfRulingOptions, _arbitratorExtraData);
141141
uint256 localDisputeID = disputes.length;
142142
disputes.push(
143143
DisputeStruct({
@@ -147,8 +147,8 @@ contract DisputeResolver is IArbitrableV2 {
147147
numberOfRulingOptions: _numberOfRulingOptions
148148
})
149149
);
150-
arbitratorDisputeIDToLocalID[disputeID] = localDisputeID;
150+
arbitratorDisputeIDToLocalID[arbitratorDisputeID] = localDisputeID;
151151
uint256 templateId = templateRegistry.setDisputeTemplate("", _disputeTemplate, _disputeTemplateDataMappings);
152-
emit DisputeRequest(arbitrator, localDisputeID, localDisputeID, templateId, _disputeTemplateUri);
152+
emit DisputeRequest(arbitrator, arbitratorDisputeID, localDisputeID, templateId, _disputeTemplateUri);
153153
}
154154
}

contracts/src/arbitration/devtools/DisputeResolverRuler.sol

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ contract DisputeResolverRuler is DisputeResolver {
4040
string memory _disputeTemplateDataMappings,
4141
string memory _disputeTemplateUri,
4242
uint256 _numberOfRulingOptions
43-
) internal override returns (uint256 disputeID) {
43+
) internal override returns (uint256 arbitratorDisputeID) {
4444
require(_numberOfRulingOptions > 1, "Should be at least 2 ruling options.");
4545

4646
uint256 localDisputeID = disputes.length;
@@ -49,10 +49,10 @@ contract DisputeResolverRuler is DisputeResolver {
4949
dispute.numberOfRulingOptions = _numberOfRulingOptions;
5050

5151
// Keep track of the upcoming dispute ID before dispute creation, so rule() can be called immediately after.
52-
disputeID = IKlerosCoreRulerFragment(address(arbitrator)).getNextDisputeID();
53-
arbitratorDisputeIDToLocalID[disputeID] = localDisputeID;
52+
arbitratorDisputeID = IKlerosCoreRulerFragment(address(arbitrator)).getNextDisputeID();
53+
arbitratorDisputeIDToLocalID[arbitratorDisputeID] = localDisputeID;
5454
uint256 templateId = templateRegistry.setDisputeTemplate("", _disputeTemplate, _disputeTemplateDataMappings);
55-
emit DisputeRequest(arbitrator, localDisputeID, localDisputeID, templateId, _disputeTemplateUri);
55+
emit DisputeRequest(arbitrator, arbitratorDisputeID, localDisputeID, templateId, _disputeTemplateUri);
5656

5757
arbitrator.createDispute{value: msg.value}(_numberOfRulingOptions, _arbitratorExtraData);
5858
}

contracts/test/arbitration/ruler.ts

+23-10
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,21 @@ describe("KlerosCoreRuler", async () => {
1717
automaticPreset, // The ruling is given automatically with a preset value.
1818
}
1919

20-
const extraData =
21-
"0x" +
22-
"0000000000000000000000000000000000000000000000000000000000000001" + // courtId 1
23-
"0000000000000000000000000000000000000000000000000000000000000003"; // minJurors 3
20+
const courtId = 1;
21+
const minJurors = 3;
22+
const disputeKitId = 1;
23+
const extraData = ethers.utils.defaultAbiCoder.encode(
24+
["uint96", "uint96", "uint256"],
25+
[courtId, minJurors, disputeKitId]
26+
);
2427

2528
before("Deploying", async () => {
2629
[deployer, dev, dev2] = await ethers.getSigners();
2730
[core, resolver] = await deployContracts(deployer);
31+
32+
// Create dummy disputes to distinguish between arbitrable-level and arbitrator-level disputeIDs
33+
await core.changeRulingModeToManual(deployer.address);
34+
await core["createDispute(uint256,bytes)"](2, extraData, { value: ethers.utils.parseEther("0.3") });
2835
});
2936

3037
it("Should have initialized the Arbitrator", async () => {
@@ -75,7 +82,9 @@ describe("KlerosCoreRuler", async () => {
7582
.to.emit(core, "RulerSettingsChanged")
7683
.withArgs(resolver.address, [RulingMode.automaticRandom, 0, false, false]);
7784

78-
const disputeID = 0;
85+
const disputeID = 1;
86+
const localDisputeID = disputeID - 1;
87+
const templateId = disputeID - 1;
7988

8089
await expect(resolver.createDisputeForTemplate(extraData, "", "", 3, { value: ethers.utils.parseEther("0.3") }))
8190
.to.emit(core, "DisputeCreation")
@@ -87,7 +96,7 @@ describe("KlerosCoreRuler", async () => {
8796
.and.to.emit(core, "TokenAndETHShift")
8897
.withArgs(dev.address, disputeID, 0, 1, 0, anyValue, ethers.constants.AddressZero)
8998
.and.to.emit(resolver, "DisputeRequest")
90-
.withArgs(core.address, disputeID, disputeID, disputeID, "")
99+
.withArgs(core.address, disputeID, localDisputeID, templateId, "")
91100
.and.to.emit(resolver, "Ruling")
92101
.withArgs(core.address, disputeID, anyValue);
93102
});
@@ -97,7 +106,9 @@ describe("KlerosCoreRuler", async () => {
97106
.to.emit(core, "RulerSettingsChanged")
98107
.withArgs(resolver.address, [RulingMode.automaticPreset, 2, true, false]);
99108

100-
const disputeID = 1;
109+
const disputeID = 2;
110+
const localDisputeID = disputeID - 1;
111+
const templateId = disputeID - 1;
101112

102113
await expect(resolver.createDisputeForTemplate(extraData, "", "", 3, { value: ethers.utils.parseEther("0.3") }))
103114
.to.emit(core, "DisputeCreation")
@@ -109,7 +120,7 @@ describe("KlerosCoreRuler", async () => {
109120
.and.to.emit(core, "TokenAndETHShift")
110121
.withArgs(dev.address, disputeID, 0, 1, 0, anyValue, ethers.constants.AddressZero)
111122
.and.to.emit(resolver, "DisputeRequest")
112-
.withArgs(core.address, disputeID, disputeID, disputeID, "")
123+
.withArgs(core.address, disputeID, localDisputeID, templateId, "")
113124
.and.to.emit(resolver, "Ruling")
114125
.withArgs(core.address, disputeID, 2);
115126
});
@@ -119,13 +130,15 @@ describe("KlerosCoreRuler", async () => {
119130
.to.emit(core, "RulerSettingsChanged")
120131
.withArgs(resolver.address, [RulingMode.manual, 0, false, false]);
121132

122-
const disputeID = 2;
133+
const disputeID = 3;
134+
const localDisputeID = disputeID - 1;
135+
const templateId = disputeID - 1;
123136

124137
await expect(resolver.createDisputeForTemplate(extraData, "", "", 3, { value: ethers.utils.parseEther("0.3") }))
125138
.to.emit(core, "DisputeCreation")
126139
.withArgs(disputeID, resolver.address)
127140
.and.to.emit(resolver, "DisputeRequest")
128-
.withArgs(core.address, disputeID, disputeID, disputeID, "");
141+
.withArgs(core.address, disputeID, localDisputeID, templateId, "");
129142

130143
await expect(core.connect(deployer).executeRuling(disputeID, 3, true, true)).revertedWithCustomError(
131144
core,

0 commit comments

Comments
 (0)