Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate dispute tags with parent arbitration policy #315

Merged
merged 4 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions contracts/modules/dispute/DisputeModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -290,25 +290,22 @@ 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;

$.disputes[disputeId] = Dispute({
targetIpId: derivativeIpId,
disputeInitiator: msg.sender,
disputeTimestamp: disputeTimestamp,
arbitrationPolicy: arbitrationPolicy,
arbitrationPolicy: parentDispute.arbitrationPolicy,
Spablob marked this conversation as resolved.
Show resolved Hide resolved
disputeEvidenceHash: "",
targetTag: parentDispute.currentTag,
currentTag: parentDispute.currentTag,
Expand Down
8 changes: 8 additions & 0 deletions test/foundry/modules/dispute/DisputeModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down