@@ -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