Skip to content

Commit 08ff5f8

Browse files
committed
fix: lock meta evidence and close #5
1 parent 7ab6860 commit 08ff5f8

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

contracts/GeneralizedTCR.sol

+10-7
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ contract GeneralizedTCR is IArbitrable, IEvidence {
5959
Arbitrator arbitrator; // The arbitrator trusted to solve disputes for this request.
6060
bytes arbitratorExtraData; // The extra data for the trusted arbitrator of this request.
6161
Status requestType; // The intent of the request. Used to keep a history of the request.
62+
uint metaEvidenceID; // The meta evidence to be used in a dispute for this case.
6263
}
6364

6465
struct Round {
@@ -236,9 +237,7 @@ contract GeneralizedTCR is IArbitrable, IEvidence {
236237
emit Dispute(
237238
request.arbitrator,
238239
request.disputeID,
239-
item.status == Status.RegistrationRequested
240-
? 2 * metaEvidenceUpdates
241-
: 2 * metaEvidenceUpdates + 1,
240+
request.metaEvidenceID,
242241
uint(keccak256(abi.encodePacked(_itemID, item.requests.length - 1)))
243242
);
244243

@@ -533,19 +532,23 @@ contract GeneralizedTCR is IArbitrable, IEvidence {
533532

534533
emit ItemSubmitted(itemID, msg.sender, item.data);
535534
}
536-
if (item.status == Status.Absent)
535+
536+
Request storage request = item.requests[item.requests.length++];
537+
if (item.status == Status.Absent) {
537538
item.status = Status.RegistrationRequested;
538-
else if (item.status == Status.Registered)
539+
request.metaEvidenceID = 2 * metaEvidenceUpdates;
540+
} else if (item.status == Status.Registered) {
539541
item.status = Status.ClearingRequested;
540-
else
542+
request.metaEvidenceID = 2 * metaEvidenceUpdates + 1;
543+
} else
541544
revert("Item already has a pending request.");
542545

543-
Request storage request = item.requests[item.requests.length++];
544546
request.parties[uint(Party.Requester)] = msg.sender;
545547
request.submissionTime = now;
546548
request.arbitrator = arbitrator;
547549
request.arbitratorExtraData = arbitratorExtraData;
548550
request.requestType = item.status;
551+
549552
Round storage round = request.rounds[request.rounds.length++];
550553

551554
uint arbitrationCost = request.arbitrator.arbitrationCost(request.arbitratorExtraData);

0 commit comments

Comments
 (0)