@@ -179,10 +179,7 @@ describe('agentescrow', () => {
179179 expect ( job . amount ) . to . equal ( 1000000 ) ;
180180 } ) ;
181181
182- // NOTE: Job funding via token transfer triggers proton-vert secondary index cache bug
183- // (db_idx64_update on job state change). All tests that require funded jobs are skipped.
184- // These tests work correctly on-chain; only the test VM is affected.
185- it . skip ( 'should fund a job (proton-vert cache bug)' , async ( ) => {
182+ it ( 'should fund a job' , async ( ) => {
186183 const deadline = Math . floor ( Date . now ( ) / 1000 ) + 86400 * 30 ;
187184 await agentescrow . actions . createjob ( [
188185 'client' , 'agent1' , 'Test Job' , 'Test description' , '["deliverable1"]' ,
@@ -198,22 +195,22 @@ describe('agentescrow', () => {
198195 expect ( job . state ) . to . equal ( 1 ) ; // FUNDED
199196 } ) ;
200197
201- it . skip ( 'should accept a funded job (proton-vert cache bug) ' , async ( ) => {
198+ it ( 'should accept a funded job' , async ( ) => {
202199 await createAndFundJob ( ) ;
203200 await agentescrow . actions . acceptjob ( [ 'agent1' , 0 ] ) . send ( 'agent1@active' ) ;
204201 const job = getJob ( 0 ) ;
205202 expect ( job . state ) . to . equal ( 2 ) ; // ACCEPTED
206203 } ) ;
207204
208- it . skip ( 'should start an accepted job (proton-vert cache bug) ' , async ( ) => {
205+ it ( 'should start an accepted job' , async ( ) => {
209206 await createAndFundJob ( ) ;
210207 await agentescrow . actions . acceptjob ( [ 'agent1' , 0 ] ) . send ( 'agent1@active' ) ;
211208 await agentescrow . actions . startjob ( [ 'agent1' , 0 ] ) . send ( 'agent1@active' ) ;
212209 const job = getJob ( 0 ) ;
213210 expect ( job . state ) . to . equal ( 3 ) ; // ACTIVE
214211 } ) ;
215212
216- it . skip ( 'should deliver an active job (proton-vert cache bug) ' , async ( ) => {
213+ it ( 'should deliver an active job' , async ( ) => {
217214 await createAndFundJob ( ) ;
218215 await agentescrow . actions . acceptjob ( [ 'agent1' , 0 ] ) . send ( 'agent1@active' ) ;
219216 await agentescrow . actions . startjob ( [ 'agent1' , 0 ] ) . send ( 'agent1@active' ) ;
@@ -222,7 +219,7 @@ describe('agentescrow', () => {
222219 expect ( job . state ) . to . equal ( 4 ) ; // DELIVERED
223220 } ) ;
224221
225- it . skip ( 'should approve a delivered job (proton-vert cache bug )' , async ( ) => {
222+ it . skip ( 'should approve a delivered job (inline token transfer triggers db access violation in vert )' , async ( ) => {
226223 await createAndFundJob ( ) ;
227224 await agentescrow . actions . acceptjob ( [ 'agent1' , 0 ] ) . send ( 'agent1@active' ) ;
228225 await agentescrow . actions . startjob ( [ 'agent1' , 0 ] ) . send ( 'agent1@active' ) ;
@@ -245,15 +242,15 @@ describe('agentescrow', () => {
245242 ) ;
246243 } ) ;
247244
248- it . skip ( 'should reject wrong agent accepting (proton-vert cache bug) ' , async ( ) => {
245+ it ( 'should reject wrong agent accepting' , async ( ) => {
249246 await createAndFundJob ( ) ;
250247 await expectToThrow (
251248 agentescrow . actions . acceptjob ( [ 'client' , 0 ] ) . send ( 'client@active' ) ,
252249 protonAssert ( 'Only assigned agent can accept' )
253250 ) ;
254251 } ) ;
255252
256- it . skip ( 'should cancel a created job (proton-vert cache bug) ' , async ( ) => {
253+ it ( 'should cancel a created job' , async ( ) => {
257254 const deadline = Math . floor ( Date . now ( ) / 1000 ) + 86400 * 30 ;
258255 await agentescrow . actions . createjob ( [
259256 'client' , 'agent1' , 'Test Job' , 'Test description' , '["deliverable1"]' ,
@@ -267,17 +264,21 @@ describe('agentescrow', () => {
267264 } ) ;
268265
269266 /* ==================== Milestones ==================== */
270- // NOTE: All milestone tests require createAndFundJob which triggers proton-vert cache bug.
271- // Skipped until proton-vert fixes db_idx64_update invariant.
272267
273268 describe ( 'milestones' , ( ) => {
274269 beforeEach ( async ( ) => {
275270 await initAll ( ) ;
276271 await registerArbitrator ( 'arbitrator1' ) ;
277272 } ) ;
278273
279- it . skip ( 'should add a milestone (proton-vert cache bug)' , async ( ) => {
280- await createAndFundJob ( ) ;
274+ it ( 'should add a milestone to unfunded job' , async ( ) => {
275+ // Milestones can only be added to CREATED (unfunded) jobs
276+ const deadline = Math . floor ( Date . now ( ) / 1000 ) + 86400 * 30 ;
277+ await agentescrow . actions . createjob ( [
278+ 'client' , 'agent1' , 'Test Job' , 'Test description' , '["deliverable1"]' ,
279+ 1000000 , '4,XPR' , deadline , 'arbitrator1' , 'jobhash123'
280+ ] ) . send ( 'client@active' ) ;
281+
281282 await agentescrow . actions . addmilestone ( [
282283 'client' , 0 , 'Phase 1' , 'First phase' , 500000 , 1
283284 ] ) . send ( 'client@active' ) ;
@@ -289,8 +290,13 @@ describe('agentescrow', () => {
289290 expect ( ms . state ) . to . equal ( 0 ) ; // pending
290291 } ) ;
291292
292- it . skip ( 'should reject milestone from non-client (proton-vert cache bug)' , async ( ) => {
293- await createAndFundJob ( ) ;
293+ it ( 'should reject milestone from non-client' , async ( ) => {
294+ const deadline = Math . floor ( Date . now ( ) / 1000 ) + 86400 * 30 ;
295+ await agentescrow . actions . createjob ( [
296+ 'client' , 'agent1' , 'Test Job' , 'Test description' , '["deliverable1"]' ,
297+ 1000000 , '4,XPR' , deadline , 'arbitrator1' , 'jobhash123'
298+ ] ) . send ( 'client@active' ) ;
299+
294300 await expectToThrow (
295301 agentescrow . actions . addmilestone ( [
296302 'agent1' , 0 , 'Phase 1' , 'First phase' , 500000 , 1
@@ -301,21 +307,19 @@ describe('agentescrow', () => {
301307 } ) ;
302308
303309 /* ==================== Disputes ==================== */
304- // NOTE: All dispute tests require createAndFundJob which triggers proton-vert cache bug.
305- // Skipped until proton-vert fixes db_idx64_update invariant.
306310
307311 describe ( 'disputes' , ( ) => {
308312 beforeEach ( async ( ) => {
309313 await initAll ( ) ;
310314 await registerArbitrator ( 'arbitrator1' ) ;
311- } ) ;
312-
313- it . skip ( 'should raise a dispute (proton-vert cache bug)' , async ( ) => {
314315 await createAndFundJob ( ) ;
316+ // Progress to DELIVERED state
315317 await agentescrow . actions . acceptjob ( [ 'agent1' , 0 ] ) . send ( 'agent1@active' ) ;
316318 await agentescrow . actions . startjob ( [ 'agent1' , 0 ] ) . send ( 'agent1@active' ) ;
317319 await agentescrow . actions . deliver ( [ 'agent1' , 0 , 'ipfs://deliverables' ] ) . send ( 'agent1@active' ) ;
320+ } ) ;
318321
322+ it ( 'should raise a dispute' , async ( ) => {
319323 await agentescrow . actions . dispute ( [
320324 'client' , 0 , 'Low quality deliverables' , 'ipfs://evidence'
321325 ] ) . send ( 'client@active' ) ;
@@ -324,29 +328,22 @@ describe('agentescrow', () => {
324328 expect ( job . state ) . to . equal ( 5 ) ; // DISPUTED
325329 } ) ;
326330
327- it . skip ( 'should arbitrate a dispute (proton-vert cache bug)' , async ( ) => {
328- await createAndFundJob ( ) ;
329- await agentescrow . actions . acceptjob ( [ 'agent1' , 0 ] ) . send ( 'agent1@active' ) ;
330- await agentescrow . actions . startjob ( [ 'agent1' , 0 ] ) . send ( 'agent1@active' ) ;
331- await agentescrow . actions . deliver ( [ 'agent1' , 0 , 'ipfs://deliverables' ] ) . send ( 'agent1@active' ) ;
331+ it . skip ( 'should arbitrate a dispute (inline token transfer db access violation)' , async ( ) => {
332332 await agentescrow . actions . dispute ( [
333333 'client' , 0 , 'Low quality deliverables' , 'ipfs://evidence'
334334 ] ) . send ( 'client@active' ) ;
335335
336+ // client_percent is 0-100 (not basis points)
336337 await agentescrow . actions . arbitrate ( [
337- 'arbitrator1' , 0 , 7000 , 'Partial delivery'
338+ 'arbitrator1' , 0 , 70 , 'Partial delivery'
338339 ] ) . send ( 'arbitrator1@active' ) ;
339340
340341 const arb = getArbitrator ( 'arbitrator1' ) ;
341342 expect ( arb . total_cases ) . to . equal ( 1 ) ;
342343 expect ( arb . successful_cases ) . to . equal ( 1 ) ;
343344 } ) ;
344345
345- it . skip ( 'should track active_disputes counter (proton-vert cache bug)' , async ( ) => {
346- await createAndFundJob ( ) ;
347- await agentescrow . actions . acceptjob ( [ 'agent1' , 0 ] ) . send ( 'agent1@active' ) ;
348- await agentescrow . actions . startjob ( [ 'agent1' , 0 ] ) . send ( 'agent1@active' ) ;
349- await agentescrow . actions . deliver ( [ 'agent1' , 0 , 'ipfs://deliverables' ] ) . send ( 'agent1@active' ) ;
346+ it . skip ( 'should track active_disputes counter (inline token transfer db access violation)' , async ( ) => {
350347 await agentescrow . actions . dispute ( [
351348 'client' , 0 , 'Low quality' , 'ipfs://evidence'
352349 ] ) . send ( 'client@active' ) ;
@@ -355,28 +352,24 @@ describe('agentescrow', () => {
355352 expect ( arbBefore . active_disputes ) . to . equal ( 1 ) ;
356353
357354 await agentescrow . actions . arbitrate ( [
358- 'arbitrator1' , 0 , 5000 , 'Split decision'
355+ 'arbitrator1' , 0 , 50 , 'Split decision'
359356 ] ) . send ( 'arbitrator1@active' ) ;
360357
361358 const arbAfter = getArbitrator ( 'arbitrator1' ) ;
362359 expect ( arbAfter . active_disputes ) . to . equal ( 0 ) ;
363360 } ) ;
364361
365- it . skip ( 'should reject arbitration from wrong arbitrator (proton-vert cache bug)' , async ( ) => {
366- await createAndFundJob ( ) ;
367- await agentescrow . actions . acceptjob ( [ 'agent1' , 0 ] ) . send ( 'agent1@active' ) ;
368- await agentescrow . actions . startjob ( [ 'agent1' , 0 ] ) . send ( 'agent1@active' ) ;
369- await agentescrow . actions . deliver ( [ 'agent1' , 0 , 'ipfs://deliverables' ] ) . send ( 'agent1@active' ) ;
362+ it ( 'should reject arbitration from wrong arbitrator' , async ( ) => {
370363 await agentescrow . actions . dispute ( [
371364 'client' , 0 , 'Low quality' , 'ipfs://evidence'
372365 ] ) . send ( 'client@active' ) ;
373366
374367 await registerArbitrator ( 'arbitrator2' , 300 ) ;
375368 await expectToThrow (
376369 agentescrow . actions . arbitrate ( [
377- 'arbitrator2' , 0 , 5000 , 'Split'
370+ 'arbitrator2' , 0 , 50 , 'Split'
378371 ] ) . send ( 'arbitrator2@active' ) ,
379- protonAssert ( 'Only assigned arbitrator can resolve ' )
372+ protonAssert ( 'Not authorized to arbitrate this job ' )
380373 ) ;
381374 } ) ;
382375 } ) ;
@@ -410,8 +403,7 @@ describe('agentescrow', () => {
410403 expect ( unstake . amount ) . to . equal ( 500000 ) ;
411404 } ) ;
412405
413- it . skip ( 'should reject unstake with active disputes (proton-vert cache bug)' , async ( ) => {
414- // Requires createAndFundJob which triggers proton-vert cache bug
406+ it ( 'should reject unstake with active disputes' , async ( ) => {
415407 await createAndFundJob ( ) ;
416408 await agentescrow . actions . acceptjob ( [ 'agent1' , 0 ] ) . send ( 'agent1@active' ) ;
417409 await agentescrow . actions . startjob ( [ 'agent1' , 0 ] ) . send ( 'agent1@active' ) ;
0 commit comments