From ae5b1a2e7b7e1a3e9eed9c248c662a4e85868c7b Mon Sep 17 00:00:00 2001 From: Spablob <99089658+Spablob@users.noreply.github.com> Date: Tue, 26 Nov 2024 11:56:18 +0000 Subject: [PATCH] Propagate dispute tags with parent arbitration policy (#315) * propagate dispute tags with parent arbitration policy * change to fork odyssey * minor unit test fix * minor unit test fix --- contracts/modules/dispute/DisputeModule.sol | 9 +++------ test/foundry/modules/dispute/DisputeModule.t.sol | 8 ++++++++ .../dispute/policies/UMA/ArbitrationPolicyUMA.t.sol | 6 +++--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/contracts/modules/dispute/DisputeModule.sol b/contracts/modules/dispute/DisputeModule.sol index 8f6023fb..6674fe18 100644 --- a/contracts/modules/dispute/DisputeModule.sol +++ b/contracts/modules/dispute/DisputeModule.sol @@ -290,17 +290,14 @@ contract DisputeModule is Dispute memory parentDispute = $.disputes[parentDisputeId]; if (parentDispute.targetIpId != parentIpId) revert Errors.DisputeModule__ParentIpIdMismatch(); - // a dispute current tag prior to being resolved can be in 3 states: + // a dispute current tag can be in 3 states: // IN_DISPUTE, 0, or a tag (ie. "IMPROPER_REGISTRATION") - // by restricting IN_DISPUTE and 0 - it is ensured the parent has been tagged before resolving dispute + // by restricting IN_DISPUTE and 0 - it is ensured the parent has been tagged before tagging the derivative if (parentDispute.currentTag == IN_DISPUTE || parentDispute.currentTag == bytes32(0)) revert Errors.DisputeModule__ParentNotTagged(); if (!LICENSE_REGISTRY.isParentIp(parentIpId, derivativeIpId)) revert Errors.DisputeModule__NotDerivative(); - address arbitrationPolicy = $.arbitrationPolicies[derivativeIpId]; - if (!$.isWhitelistedArbitrationPolicy[arbitrationPolicy]) arbitrationPolicy = $.baseArbitrationPolicy; - uint256 disputeId = ++$.disputeCounter; uint256 disputeTimestamp = block.timestamp; @@ -308,7 +305,7 @@ contract DisputeModule is targetIpId: derivativeIpId, disputeInitiator: msg.sender, disputeTimestamp: disputeTimestamp, - arbitrationPolicy: arbitrationPolicy, + arbitrationPolicy: parentDispute.arbitrationPolicy, disputeEvidenceHash: "", targetTag: parentDispute.currentTag, currentTag: parentDispute.currentTag, diff --git a/test/foundry/modules/dispute/DisputeModule.t.sol b/test/foundry/modules/dispute/DisputeModule.t.sol index c0c50dd0..cb6042f4 100644 --- a/test/foundry/modules/dispute/DisputeModule.t.sol +++ b/test/foundry/modules/dispute/DisputeModule.t.sol @@ -564,6 +564,14 @@ contract DisputeModuleTest is BaseTest { assertEq(licenseRegistry.isParentIp(ipAddr, ipAddr2), true); + // child ip changes arbitration policy + vm.startPrank(address(ipAddr2)); + disputeModule.setArbitrationPolicy(ipAddr2, address(mockArbitrationPolicy2)); + vm.warp(block.timestamp + disputeModule.arbitrationPolicyCooldown() + 1); + disputeModule.updateActiveArbitrationPolicy(ipAddr2); + assertEq(disputeModule.arbitrationPolicies(ipAddr2), address(mockArbitrationPolicy2)); + vm.stopPrank(); + // tag child ip vm.startPrank(address(1)); vm.expectEmit(true, true, true, true, address(disputeModule)); diff --git a/test/foundry/modules/dispute/policies/UMA/ArbitrationPolicyUMA.t.sol b/test/foundry/modules/dispute/policies/UMA/ArbitrationPolicyUMA.t.sol index c8364662..4407af98 100644 --- a/test/foundry/modules/dispute/policies/UMA/ArbitrationPolicyUMA.t.sol +++ b/test/foundry/modules/dispute/policies/UMA/ArbitrationPolicyUMA.t.sol @@ -42,13 +42,13 @@ contract ArbitrationPolicyUMATest is BaseTest { function setUp() public virtual override { // Fork the desired network where UMA contracts are deployed - uint256 forkId = vm.createFork("https://testnet.storyrpc.io"); + uint256 forkId = vm.createFork("https://odyssey.storyrpc.io/"); vm.selectFork(forkId); - // Illiad chain 1513 + // Odyssey testnet newOOV3 = 0x3CA11702f7c0F28e0b4e03C31F7492969862C569; mockAncillary = 0x3baD7AD0728f9917d1Bf08af5782dCbD516cDd96; - susd = 0x91f6F05B08c16769d3c85867548615d270C42fC7; + susd = 0xC0F6E387aC0B324Ec18EAcf22EE7271207dCE3d5; // deploy mock ip asset registry mockIpAssetRegistry = new MockIpAssetRegistry();