@@ -17,14 +17,21 @@ describe("KlerosCoreRuler", async () => {
17
17
automaticPreset , // The ruling is given automatically with a preset value.
18
18
}
19
19
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
+ ) ;
24
27
25
28
before ( "Deploying" , async ( ) => {
26
29
[ deployer , dev , dev2 ] = await ethers . getSigners ( ) ;
27
30
[ 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" ) } ) ;
28
35
} ) ;
29
36
30
37
it ( "Should have initialized the Arbitrator" , async ( ) => {
@@ -75,7 +82,9 @@ describe("KlerosCoreRuler", async () => {
75
82
. to . emit ( core , "RulerSettingsChanged" )
76
83
. withArgs ( resolver . address , [ RulingMode . automaticRandom , 0 , false , false ] ) ;
77
84
78
- const disputeID = 0 ;
85
+ const disputeID = 1 ;
86
+ const localDisputeID = disputeID - 1 ;
87
+ const templateId = disputeID - 1 ;
79
88
80
89
await expect ( resolver . createDisputeForTemplate ( extraData , "" , "" , 3 , { value : ethers . utils . parseEther ( "0.3" ) } ) )
81
90
. to . emit ( core , "DisputeCreation" )
@@ -87,7 +96,7 @@ describe("KlerosCoreRuler", async () => {
87
96
. and . to . emit ( core , "TokenAndETHShift" )
88
97
. withArgs ( dev . address , disputeID , 0 , 1 , 0 , anyValue , ethers . constants . AddressZero )
89
98
. and . to . emit ( resolver , "DisputeRequest" )
90
- . withArgs ( core . address , disputeID , disputeID , disputeID , "" )
99
+ . withArgs ( core . address , disputeID , localDisputeID , templateId , "" )
91
100
. and . to . emit ( resolver , "Ruling" )
92
101
. withArgs ( core . address , disputeID , anyValue ) ;
93
102
} ) ;
@@ -97,7 +106,9 @@ describe("KlerosCoreRuler", async () => {
97
106
. to . emit ( core , "RulerSettingsChanged" )
98
107
. withArgs ( resolver . address , [ RulingMode . automaticPreset , 2 , true , false ] ) ;
99
108
100
- const disputeID = 1 ;
109
+ const disputeID = 2 ;
110
+ const localDisputeID = disputeID - 1 ;
111
+ const templateId = disputeID - 1 ;
101
112
102
113
await expect ( resolver . createDisputeForTemplate ( extraData , "" , "" , 3 , { value : ethers . utils . parseEther ( "0.3" ) } ) )
103
114
. to . emit ( core , "DisputeCreation" )
@@ -109,7 +120,7 @@ describe("KlerosCoreRuler", async () => {
109
120
. and . to . emit ( core , "TokenAndETHShift" )
110
121
. withArgs ( dev . address , disputeID , 0 , 1 , 0 , anyValue , ethers . constants . AddressZero )
111
122
. and . to . emit ( resolver , "DisputeRequest" )
112
- . withArgs ( core . address , disputeID , disputeID , disputeID , "" )
123
+ . withArgs ( core . address , disputeID , localDisputeID , templateId , "" )
113
124
. and . to . emit ( resolver , "Ruling" )
114
125
. withArgs ( core . address , disputeID , 2 ) ;
115
126
} ) ;
@@ -119,13 +130,15 @@ describe("KlerosCoreRuler", async () => {
119
130
. to . emit ( core , "RulerSettingsChanged" )
120
131
. withArgs ( resolver . address , [ RulingMode . manual , 0 , false , false ] ) ;
121
132
122
- const disputeID = 2 ;
133
+ const disputeID = 3 ;
134
+ const localDisputeID = disputeID - 1 ;
135
+ const templateId = disputeID - 1 ;
123
136
124
137
await expect ( resolver . createDisputeForTemplate ( extraData , "" , "" , 3 , { value : ethers . utils . parseEther ( "0.3" ) } ) )
125
138
. to . emit ( core , "DisputeCreation" )
126
139
. withArgs ( disputeID , resolver . address )
127
140
. and . to . emit ( resolver , "DisputeRequest" )
128
- . withArgs ( core . address , disputeID , disputeID , disputeID , "" ) ;
141
+ . withArgs ( core . address , disputeID , localDisputeID , templateId , "" ) ;
129
142
130
143
await expect ( core . connect ( deployer ) . executeRuling ( disputeID , 3 , true , true ) ) . revertedWithCustomError (
131
144
core ,
0 commit comments