@@ -34,12 +34,15 @@ module.exports = async (web3, batchedSend) => {
3434 try {
3535 let disputeID = process . env . STARTING_DISPUTE_ID || 0 ;
3636 while ( true ) {
37+ console . debug ( `Processing dispute ${ disputeID } ` ) ;
3738 if ( ! executedDisputeIDs [ disputeID ] ) {
3839 let dispute ;
3940 try {
4041 dispute = await klerosLiquid . methods . disputes ( disputeID ) . call ( ) ;
41- } catch ( _ ) {
42- //console.log(e);
42+ } catch ( e ) {
43+ console . error (
44+ `Error trying to read dispute ${ disputeID } : ${ e . message } `
45+ ) ;
4346 break ;
4447 }
4548 const dispute2 = await klerosLiquid . methods
@@ -55,6 +58,9 @@ module.exports = async (web3, batchedSend) => {
5558 . call ( ) ;
5659 } catch ( _ ) {
5760 // Look it up manually if numberOfChoices is too high for loop
61+ console . debug (
62+ `Looking up vote counter manually for dispute ${ disputeID } , choice ${ i } `
63+ ) ;
5864 let tied = true ;
5965 let winningChoice = "0" ;
6066 const _voteCounters = { } ;
@@ -95,13 +101,17 @@ module.exports = async (web3, batchedSend) => {
95101 return voteCounter ;
96102 } )
97103 ) ;
104+ console . debug ( `Vote counter has ${ voteCounters . length } entries` ) ;
98105
99106 const notTieAndNoOneCoherent = voteCounters . map (
100107 ( v ) =>
101108 ! voteCounters [ voteCounters . length - 1 ] . tied &&
102109 v . counts [ voteCounters [ voteCounters . length - 1 ] . winningChoice ] ===
103110 "0"
104111 ) ;
112+ console . debug (
113+ `No tie and no coherent votes for dispute ${ disputeID } : ${ notTieAndNoOneCoherent } `
114+ ) ;
105115 if (
106116 ! dispute . ruled ||
107117 dispute2 . votesLengths . some (
@@ -148,6 +158,8 @@ module.exports = async (web3, batchedSend) => {
148158 executedDisputeIDs [ disputeID ] = true ; // The dispute is finalized, cache it.
149159 console . log ( "Dispute %s is finalized, caching it." , disputeID ) ;
150160 }
161+ } else {
162+ console . debug ( `Dispute ${ disputeID } is already executed.` ) ;
151163 }
152164 disputeID ++ ;
153165 }
@@ -163,22 +175,26 @@ module.exports = async (web3, batchedSend) => {
163175 const disputesWithoutJurors = await klerosLiquid . methods
164176 . disputesWithoutJurors ( )
165177 . call ( ) ;
178+ console . log ( `Checking if reay to move phase` ) ;
166179 if ( phase == PhaseEnum . staking ) {
167180 const minStakingTime = await klerosLiquid . methods . minStakingTime ( ) . call ( ) ;
168181 if (
169182 Date . now ( ) - lastPhaseChange * 1000 >= minStakingTime * 1000 &&
170183 disputesWithoutJurors > 0
171184 ) {
185+ console . debug ( `Ready to move from staking to generating` ) ;
172186 readyForNextPhase = true ;
173187 }
174188 } else if ( phase == PhaseEnum . generating ) {
189+ console . debug ( `Ready to move from generating to drawing` ) ;
175190 readyForNextPhase = true ;
176191 } else if ( phase == PhaseEnum . drawing ) {
177192 const maxDrawingTime = await klerosLiquid . methods . maxDrawingTime ( ) . call ( ) ;
178193 if (
179194 Date . now ( ) - lastPhaseChange * 1000 >= maxDrawingTime * 1000 ||
180195 disputesWithoutJurors == 0
181196 ) {
197+ console . debug ( `Ready to move from drawing to staking` ) ;
182198 readyForNextPhase = true ;
183199 }
184200 }
0 commit comments