@@ -340,6 +340,16 @@ describe("Dispute Functions", () => {
340340 } ) ;
341341
342342 it ( "should tag a single IP as infringing without using multicall" , async ( ) => {
343+ /**
344+ * Test Flow:
345+ * 1. Set judgment on an existing dispute to mark it as valid
346+ * 2. Verify the dispute state changed correctly after judgment
347+ * 3. Try to tag a derivative IP using the judged dispute
348+ */
349+
350+ // Step 1: Set dispute judgment using the judge wallet
351+ // When judgment is true, the dispute's currentTag will be set to the targetTag
352+ // When false, currentTag would be set to bytes32(0)
343353 const { request } = await publicClient . simulateContract ( {
344354 address : DISPUTE_MODULE_ADDRESS ,
345355 abi : [ SET_DISPUTE_JUDGEMENT_ABI ] ,
@@ -350,28 +360,47 @@ describe("Dispute Functions", () => {
350360 const judgmentTxHash = await judgeWalletClient . writeContract ( request ) ;
351361 await publicClient . waitForTransactionReceipt ( { hash : judgmentTxHash } ) ;
352362
353- const disputeState = await publicClient . readContract ( {
363+ // Step 2: Verify dispute state
364+ // The disputes() function returns multiple values about the dispute:
365+ // - targetTag: the tag we wanted to apply when raising the dispute
366+ // - currentTag: the current state of the dispute after judgment
367+ // After a successful judgment, currentTag should equal targetTag
368+ const [
369+ _targetIpId , // IP being disputed
370+ _disputeInitiator , // Address that raised the dispute
371+ _disputeTimestamp , // When dispute was raised
372+ _arbitrationPolicy , // Policy used for arbitration
373+ _disputeEvidenceHash , // Evidence hash for dispute
374+ targetTag , // Tag we want to apply (e.g. "IMPROPER_REGISTRATION")
375+ currentTag , // Current state of dispute
376+ _infringerDisputeId , // Related dispute ID if this is a propagated tag
377+ ] = await publicClient . readContract ( {
354378 address : disputeModuleAddress [ aeneid ] ,
355379 abi : disputeModuleAbi ,
356380 functionName : "disputes" ,
357381 args : [ disputeId ] ,
358382 } ) ;
383+ expect ( currentTag ) . to . equal ( targetTag ) ; // Verify judgment was recorded correctly
359384
360- expect ( disputeState [ 6 ] ) . to . equal ( disputeState [ 5 ] ) ;
361-
385+ // Step 3: Attempt to tag a derivative IP
386+ // This will fail if:
387+ // - The dispute is not in a valid state (still IN_DISPUTE or cleared)
388+ // - The IP we're trying to tag is not actually a derivative of the disputed IP
389+ // - The dispute has already been used to tag this IP
362390 const response = await clientA . dispute . tagIfRelatedIpInfringed ( {
363391 infringementTags : [
364392 {
365- ipId : childIpId ,
366- disputeId : disputeId ,
393+ ipId : childIpId , // The derivative IP to tag
394+ disputeId : disputeId , // Using the judged dispute as basis for tagging
367395 } ,
368396 ] ,
369397 options : {
370- useMulticallWhenPossible : false ,
398+ useMulticallWhenPossible : false , // Force single transaction instead of batch
371399 } ,
372400 txOptions : { waitForTransaction : true } ,
373401 } ) ;
374402
403+ // Verify we got the expected response
375404 expect ( response ) . to . have . lengthOf ( 1 ) ;
376405 expect ( response [ 0 ] . txHash ) . to . be . a ( "string" ) . and . not . empty ;
377406 } ) ;
0 commit comments