diff --git a/contracts/extensions/Tasks.sol b/contracts/extensions/Tasks.sol index a9a74afc1e..d25870cfda 100644 --- a/contracts/extensions/Tasks.sol +++ b/contracts/extensions/Tasks.sol @@ -116,33 +116,33 @@ contract Tasks is DSMath { } modifier self() { - require(address(this) == msg.sender, "colony-task-not-self"); + require(address(this) == msg.sender, "task-not-self"); _; } + ColonyDataTypes.ColonyRole constant ADMIN = ColonyDataTypes.ColonyRole.Administration; modifier isAdmin(address _user, uint256 _permissionDomainId, uint256 _childSkillIndex, uint256 _domainId) { - ColonyDataTypes.ColonyRole admin = ColonyDataTypes.ColonyRole.Administration; - require(colony.hasInheritedUserRole(_user, _permissionDomainId, admin, _childSkillIndex, _domainId), "colony-task-not-admin"); + require(colony.hasInheritedUserRole(_user, _permissionDomainId, ADMIN, _childSkillIndex, _domainId), "task-not-admin"); _; } modifier taskExists(uint256 _id) { - require(_id > 0 && _id <= taskCount, "colony-task-does-not-exist"); + require(doesTaskExist(_id), "task-does-not-exist"); _; } modifier taskComplete(uint256 _id) { - require(tasks[_id].completionTimestamp > 0, "colony-task-not-complete"); + require(isTaskComplete(_id), "task-not-complete"); _; } modifier taskNotComplete(uint256 _id) { - require(tasks[_id].completionTimestamp == 0, "colony-task-complete"); + require(!isTaskComplete(_id), "task-complete"); _; } modifier confirmTaskRoleIdentity(uint256 _id, address _user, TaskRole _role) { - require(msg.sender == getTaskRoleUser(_id, _role), "colony-task-role-identity-mismatch"); + require(getTaskRoleUser(_id, _role) == msg.sender, "task-role-identity-mismatch"); _; } @@ -156,17 +156,17 @@ contract Tasks is DSMath { ) public { - require(_value == 0, "colony-task-change-non-zero-value"); - require(_sigR.length == _sigS.length && _sigR.length == _sigV.length, "colony-task-change-signatures-count-do-not-match"); + require(_value == 0, "task-change-non-zero-value"); + require(_sigR.length == _sigS.length && _sigR.length == _sigV.length, "task-change-sig-count-no-match"); bytes4 sig; uint256 taskId; (sig, taskId) = deconstructCall(_data); - require(taskId > 0 && taskId <= taskCount, "colony-task-does-not-exist"); - require(!roleAssignmentSigs[sig], "colony-task-change-is-role-assignment"); + require(taskId > 0 && taskId <= taskCount, "task-does-not-exist"); + require(!roleAssignmentSigs[sig], "task-change-is-role-assign"); ColonyDataTypes.ExpenditureStatus status = colony.getExpenditure(tasks[taskId].expenditureId).status; - require(status != ColonyDataTypes.ExpenditureStatus.Finalized, "colony-task-finalized"); + require(status != ColonyDataTypes.ExpenditureStatus.Finalized, "task-finalized"); uint8 nSignaturesRequired; address taskRole1User = getTaskRoleUser(taskId, TaskRole(reviewers[sig][0])); @@ -180,26 +180,26 @@ contract Tasks is DSMath { } else { nSignaturesRequired = 2; } - require(_sigR.length == nSignaturesRequired, "colony-task-change-does-not-meet-signatures-required"); + require(_sigR.length == nSignaturesRequired, "task-change-wrong-num-sigs"); bytes32 msgHash = keccak256(abi.encodePacked(address(this), address(this), _value, _data, tasks[taskId].changeNonce)); address[] memory reviewerAddresses = getReviewerAddresses(_sigV, _sigR, _sigS, _mode, msgHash); require( reviewerAddresses[0] == taskRole1User || reviewerAddresses[0] == taskRole2User, - "colony-task-signatures-do-not-match-reviewer-1" + "task-sigs-no-match-reviewer-1" ); if (nSignaturesRequired == 2) { - require(reviewerAddresses[0] != reviewerAddresses[1], "colony-task-duplicate-reviewers"); + require(reviewerAddresses[0] != reviewerAddresses[1], "task-duplicate-reviewers"); require( reviewerAddresses[1] == taskRole1User || reviewerAddresses[1] == taskRole2User, - "colony-task-signatures-do-not-match-reviewer-2" + "task-sigs-no-match-reviewer-2" ); } tasks[taskId].changeNonce += 1; - require(executeCall(address(this), _value, _data), "colony-task-change-execution-failed"); + require(executeCall(address(this), _value, _data), "task-change-execution-failed"); } function executeTaskRoleAssignment( @@ -212,18 +212,18 @@ contract Tasks is DSMath { ) public { - require(_value == 0, "colony-task-role-assignment-non-zero-value"); - require(_sigR.length == _sigS.length && _sigR.length == _sigV.length, "colony-task-role-assignment-signatures-count-do-not-match"); + require(_value == 0, "task-role-assign-non-zero-value"); + require(_sigR.length == _sigS.length && _sigR.length == _sigV.length, "task-role-assign-sig-count-no-match"); bytes4 sig; uint256 taskId; address userAddress; (sig, taskId, userAddress) = deconstructRoleChangeCall(_data); - require(taskId > 0 && taskId <= taskCount, "colony-task-does-not-exist"); - require(roleAssignmentSigs[sig], "colony-task-change-is-not-role-assignment"); + require(taskId > 0 && taskId <= taskCount, "task-does-not-exist"); + require(roleAssignmentSigs[sig], "task-change-is-not-role-assign"); ColonyDataTypes.ExpenditureStatus status = colony.getExpenditure(tasks[taskId].expenditureId).status; - require(status != ColonyDataTypes.ExpenditureStatus.Finalized, "colony-task-finalized"); + require(status != ColonyDataTypes.ExpenditureStatus.Finalized, "task-finalized"); uint8 nSignaturesRequired; address manager = getTaskRoleUser(taskId, TaskRole.Manager); @@ -233,36 +233,36 @@ contract Tasks is DSMath { } else { nSignaturesRequired = 2; } - require(_sigR.length == nSignaturesRequired, "colony-task-role-assignment-does-not-meet-required-signatures"); + require(_sigR.length == nSignaturesRequired, "task-role-assign-wrong-num-sigs"); bytes32 msgHash = keccak256(abi.encodePacked(address(this), address(this), _value, _data, tasks[taskId].changeNonce)); address[] memory reviewerAddresses = getReviewerAddresses(_sigV, _sigR, _sigS, _mode, msgHash); if (nSignaturesRequired == 1) { // Since we want to set a manager as an evaluator, require just manager's signature - require(reviewerAddresses[0] == manager, "colony-task-role-assignment-not-signed-by-manager"); + require(reviewerAddresses[0] == manager, "task-role-assign-no-manager-sig"); } else { // One of signers must be a manager require( reviewerAddresses[0] == manager || reviewerAddresses[1] == manager, - "colony-task-role-assignment-not-signed-by-manager" + "task-role-assign-no-manager-sig" ); // One of the signers must be an address we want to set here require( userAddress == reviewerAddresses[0] || userAddress == reviewerAddresses[1], - "colony-task-role-assignment-not-signed-by-new-user-for-role" + "task-role-assign-no-new-user-sig" ); // Require that signatures are not from the same address // This will never throw, because we require that manager is one of the signers, // and if manager is both signers, then `userAddress` must also be a manager, and if // `userAddress` is a manager, then we require 1 signature (will be kept for possible future changes) - require(reviewerAddresses[0] != reviewerAddresses[1], "colony-task-role-assignment-duplicate-signatures"); + require(reviewerAddresses[0] != reviewerAddresses[1], "task-role-assign-duplicate-sigs"); } tasks[taskId].changeNonce += 1; - require(executeCall(address(this), _value, _data), "colony-task-role-assignment-execution-failed"); + require(executeCall(address(this), _value, _data), "task-role-assign-exec-failed"); } // Permissions pertain to the Administration role here @@ -302,15 +302,15 @@ contract Tasks is DSMath { taskComplete(_id) { if (_role == TaskRole.Manager) { // Manager rated by worker - require(msg.sender == getTaskRoleUser(_id, TaskRole.Worker), "colony-user-cannot-rate-task-manager"); + require(msg.sender == getTaskRoleUser(_id, TaskRole.Worker), "task-user-cannot-rate-manager"); } else if (_role == TaskRole.Worker) { // Worker rated by evaluator - require(msg.sender == getTaskRoleUser(_id, TaskRole.Evaluator), "colony-user-cannot-rate-task-worker"); + require(msg.sender == getTaskRoleUser(_id, TaskRole.Evaluator), "task-user-cannot-rate-worker"); } else { - revert("colony-unsupported-role-to-rate"); + revert("task-unsupported-role-to-rate"); } - require(sub(now, tasks[_id].completionTimestamp) <= RATING_COMMIT_TIMEOUT, "colony-task-rating-secret-submit-period-closed"); - require(ratingSecrets[_id].secret[uint8(_role)] == "", "colony-task-rating-secret-already-exists"); + require(sub(now, tasks[_id].completionTimestamp) <= RATING_COMMIT_TIMEOUT, "task-secret-submissions-closed"); + require(ratingSecrets[_id].secret[uint8(_role)] == "", "task-secret-already-exists"); ratingSecrets[_id].count += 1; ratingSecrets[_id].timestamp = now; @@ -326,18 +326,18 @@ contract Tasks is DSMath { // Otherwise start the reveal period after the commit period has expired // In both cases, keep reveal period open for 5 days if (ratingSecrets[_id].count == 2) { - require(sub(now, ratingSecrets[_id].timestamp) <= RATING_REVEAL_TIMEOUT, "colony-task-rating-secret-reveal-period-closed"); + require(sub(now, ratingSecrets[_id].timestamp) <= RATING_REVEAL_TIMEOUT, "task-secret-reveal-closed"); } else { uint taskCompletionTime = tasks[_id].completionTimestamp; - require(sub(now, taskCompletionTime) > RATING_COMMIT_TIMEOUT, "colony-task-rating-secret-reveal-period-not-open"); - require(sub(now, taskCompletionTime) <= add(RATING_COMMIT_TIMEOUT, RATING_REVEAL_TIMEOUT), "colony-task-rating-secret-reveal-period-closed"); + require(sub(now, taskCompletionTime) > RATING_COMMIT_TIMEOUT, "task-secret-reveal-not-open"); + require(sub(now, taskCompletionTime) <= add(RATING_COMMIT_TIMEOUT, RATING_REVEAL_TIMEOUT), "task-secret-reveal-closed"); } bytes32 secret = generateSecret(_salt, _rating); - require(secret == ratingSecrets[_id].secret[uint8(_role)], "colony-task-rating-secret-mismatch"); + require(secret == ratingSecrets[_id].secret[uint8(_role)], "task-secret-mismatch"); TaskRatings rating = TaskRatings(_rating); - require(rating != TaskRatings.None, "colony-task-rating-missing"); + require(rating != TaskRatings.None, "task-rating-missing"); taskRoles[_id][uint8(_role)].rating = rating; emit TaskWorkRatingRevealed(_id, _role, _rating); @@ -366,15 +366,15 @@ contract Tasks is DSMath { function setTaskEvaluatorRole(uint256 _id, address payable _user) public self { // Can only assign role if no one is currently assigned to it - require(getTaskRoleUser(_id, TaskRole.Evaluator) == address(0x0), "colony-task-evaluator-role-already-assigned"); + require(getTaskRoleUser(_id, TaskRole.Evaluator) == address(0x0), "task-evaluator-role-assigned"); setTaskRoleUser(_id, TaskRole.Evaluator, _user); } function setTaskWorkerRole(uint256 _id, address payable _user) public self { // Can only assign role if no one is currently assigned to it - require(getTaskRoleUser(_id, TaskRole.Worker) == address(0x0), "colony-task-worker-role-already-assigned"); + require(getTaskRoleUser(_id, TaskRole.Worker) == address(0x0), "task-worker-role-assigned"); uint256[] memory skills = colony.getExpenditureSlot(tasks[_id].expenditureId, uint256(TaskRole.Worker)).skills; - require(skills[0] > 0, "colony-task-skill-not-set"); // ignore-swc-110 + require(skills.length > 0 && skills[0] > 0, "task-skill-not-set"); // ignore-swc-110 setTaskRoleUser(_id, TaskRole.Worker, _user); } @@ -413,8 +413,8 @@ contract Tasks is DSMath { address evaluator = getTaskRoleUser(_id, TaskRole.Evaluator); address worker = getTaskRoleUser(_id, TaskRole.Worker); - require(evaluator == manager || evaluator == address(0x0), "colony-funding-evaluator-already-set"); - require(worker == manager || worker == address(0x0), "colony-funding-worker-already-set"); + require(evaluator == manager || evaluator == address(0x0), "task-evaluator-already-set"); + require(worker == manager || worker == address(0x0), "task-worker-already-set"); this.setTaskManagerPayout(_id, _token, _managerAmount); this.setTaskEvaluatorPayout(_id, _token, _evaluatorAmount); @@ -471,7 +471,7 @@ contract Tasks is DSMath { taskNotComplete(_id) confirmTaskRoleIdentity(_id, msg.sender, TaskRole.Manager) { - require(now >= tasks[_id].dueDate, "colony-task-due-date-in-future"); + require(now >= tasks[_id].dueDate, "task-due-date-in-future"); tasks[_id].completionTimestamp = now; emit TaskCompleted(_id); @@ -643,7 +643,7 @@ contract Tasks is DSMath { } function assignWorkRatings(uint256 _id) internal { - require(taskWorkRatingsAssigned(_id) || taskWorkRatingsClosed(_id), "colony-task-ratings-not-closed"); + require(taskWorkRatingsAssigned(_id) || taskWorkRatingsClosed(_id), "task-ratings-not-closed"); // In the event of a user not committing/revealing within the rating window, // their rating of their counterpart is assumed to be the maximum @@ -668,7 +668,7 @@ contract Tasks is DSMath { } function setTaskRoleUser(uint256 _id, TaskRole _role, address payable _user) - private + internal taskExists(_id) taskNotComplete(_id) { @@ -679,4 +679,12 @@ contract Tasks is DSMath { colony.setExpenditureRecipient(tasks[_id].expenditureId, uint256(_role), _user); } + + function doesTaskExist(uint256 _id) internal view returns (bool) { + return _id > 0 && _id <= taskCount; + } + + function isTaskComplete(uint256 _id) internal view returns (bool) { + return tasks[_id].completionTimestamp > 0; + } } diff --git a/test/extensions/tasks.js b/test/extensions/tasks.js index e7b050decd..1d81f19a41 100644 --- a/test/extensions/tasks.js +++ b/test/extensions/tasks.js @@ -125,7 +125,7 @@ contract("Tasks extension", accounts => { }); it("should fail if a non-admin user tries to make a task", async () => { - await checkErrorRevert(tasks.makeTask(1, 0, 1, 0, SPECIFICATION_HASH, 1, 0, 0, { from: OTHER }), "colony-task-not-admin"); + await checkErrorRevert(tasks.makeTask(1, 0, 1, 0, SPECIFICATION_HASH, 1, 0, 0, { from: OTHER }), "task-not-admin"); }); it("should set the task creator as the manager and evaluator", async () => { @@ -241,7 +241,7 @@ contract("Tasks extension", accounts => { sigTypes: [0, 0], args: [taskId.addn(1), WORKER] }), - "colony-task-does-not-exist" + "task-does-not-exist" ); }); @@ -279,7 +279,7 @@ contract("Tasks extension", accounts => { sigTypes: [0, 0], args: [taskId, WORKER] }), - "colony-task-change-is-not-role-assignment" + "task-change-is-not-role-assign" ); }); @@ -296,7 +296,7 @@ contract("Tasks extension", accounts => { args: [taskId, WORKER] }); - await checkErrorRevert(tasks.executeTaskRoleAssignment(sigV, sigR, sigS, [0, 0], 10, txData), "colony-task-role-assignment-non-zero-value"); + await checkErrorRevert(tasks.executeTaskRoleAssignment(sigV, sigR, sigS, [0, 0], 10, txData), "task-role-assign-non-zero-value"); }); it("should not be able to execute task change when the number of signature parts differ", async () => { @@ -312,10 +312,7 @@ contract("Tasks extension", accounts => { args: [taskId, WORKER] }); - await checkErrorRevert( - tasks.executeTaskRoleAssignment([sigV[0]], sigR, sigS, [0], 0, txData), - "colony-task-role-assignment-signatures-count-do-not-match" - ); + await checkErrorRevert(tasks.executeTaskRoleAssignment([sigV[0]], sigR, sigS, [0], 0, txData), "task-role-assign-sig-count-no-match"); }); it("should allow the evaluator and worker roles to be assigned", async () => { @@ -372,7 +369,7 @@ contract("Tasks extension", accounts => { sigTypes: [0, 0], args: [taskId, WORKER] }), - "colony-task-role-assignment-execution-failed" + "task-role-assign-exec-failed" ); await executeSignedTaskChange({ @@ -419,7 +416,7 @@ contract("Tasks extension", accounts => { sigTypes: [0], args: [taskId, newEvaluator] }), - "colony-task-role-assignment-does-not-meet-required-signatures" + "task-role-assign-wrong-num-sigs" ); await checkErrorRevert( @@ -431,7 +428,7 @@ contract("Tasks extension", accounts => { sigTypes: [0], args: [taskId, WORKER] }), - "colony-task-role-assignment-does-not-meet-required-signatures" + "task-role-assign-wrong-num-sigs" ); }); @@ -448,7 +445,7 @@ contract("Tasks extension", accounts => { sigTypes: [0, 0], args: [taskId, OTHER] }), - "colony-task-role-assignment-execution-failed" + "task-role-assign-exec-failed" ); await executeSignedRoleAssignment({ @@ -469,7 +466,7 @@ contract("Tasks extension", accounts => { sigTypes: [0, 0], args: [taskId, OTHER] }), - "colony-task-role-assignment-execution-failed" + "task-role-assign-exec-failed" ); }); @@ -499,7 +496,7 @@ contract("Tasks extension", accounts => { sigTypes: [0, 0], args: [taskId, ethers.constants.AddressZero] }), - "colony-task-role-assignment-not-signed-by-new-user-for-role" + "task-role-assign-no-new-user-sig" ); // Now they do! @@ -529,7 +526,7 @@ contract("Tasks extension", accounts => { sigTypes: [0, 0], args: [taskId, WORKER] }), - "colony-task-role-assignment-not-signed-by-new-user-for-role" + "task-role-assign-no-new-user-sig" ); }); @@ -563,7 +560,7 @@ contract("Tasks extension", accounts => { sigTypes: [0], args: [taskId, WORKER] }), - "colony-task-role-assignment-does-not-meet-required-signatures" + "task-role-assign-wrong-num-sigs" ); }); @@ -597,7 +594,7 @@ contract("Tasks extension", accounts => { sigTypes: [0, 0], args: [taskId, WORKER] }), - "colony-task-role-assignment-not-signed-by-manager" + "task-role-assign-no-manager-sig" ); }); @@ -631,7 +628,7 @@ contract("Tasks extension", accounts => { sigTypes: [0], args: [taskId, MANAGER] }), - "colony-task-role-assignment-not-signed-by-manager" + "task-role-assign-no-manager-sig" ); }); @@ -648,7 +645,7 @@ contract("Tasks extension", accounts => { sigTypes: [0, 0], args: [taskId, ADMIN, 1, 0] }), - "colony-task-role-assignment-not-signed-by-new-user-for-role" + "task-role-assign-no-new-user-sig" ); }); @@ -665,7 +662,7 @@ contract("Tasks extension", accounts => { sigTypes: [0, 0], args: [taskId, OTHER, 1, 0] }), - "colony-task-role-assignment-execution-failed" + "task-role-assign-exec-failed" ); }); @@ -682,7 +679,7 @@ contract("Tasks extension", accounts => { sigTypes: [0, 0], args: [taskId, ethers.constants.AddressZero, 1, 0] }), - "colony-task-role-assignment-not-signed-by-new-user-for-role" + "task-role-assign-no-new-user-sig" ); }); @@ -732,7 +729,7 @@ contract("Tasks extension", accounts => { sigTypes: [0, 0], args: [taskId, WORKER, 1, 0] }), - "colony-task-role-assignment-not-signed-by-manager" + "task-role-assign-no-manager-sig" ); }); @@ -900,7 +897,7 @@ contract("Tasks extension", accounts => { sigTypes: [0, 1], args: [taskId, SPECIFICATION_HASH_UPDATED] }), - "colony-task-duplicate-reviewers" + "task-duplicate-reviewers" ); }); @@ -935,7 +932,7 @@ contract("Tasks extension", accounts => { await tasks.makeTask(1, 0, 1, 0, SPECIFICATION_HASH, 1, 0, 0, { from: MANAGER }); const taskId = await tasks.getTaskCount(); - await checkErrorRevert(tasks.setTaskBrief(taskId, SPECIFICATION_HASH_UPDATED, { from: OTHER }), "colony-task-not-self"); + await checkErrorRevert(tasks.setTaskBrief(taskId, SPECIFICATION_HASH_UPDATED, { from: OTHER }), "task-not-self"); }); it("should fail update of task brief signed by a non-registered role", async () => { @@ -951,7 +948,7 @@ contract("Tasks extension", accounts => { sigTypes: [0, 0], args: [taskId, SPECIFICATION_HASH_UPDATED] }), - "colony-task-change-does-not-meet-signatures-required" + "task-change-wrong-num-sigs" ); }); @@ -977,7 +974,7 @@ contract("Tasks extension", accounts => { sigTypes: [0], args: [taskId, SPECIFICATION_HASH_UPDATED] }), - "colony-task-change-does-not-meet-signatures-required" + "task-change-wrong-num-sigs" ); }); @@ -994,7 +991,7 @@ contract("Tasks extension", accounts => { sigTypes: [0, 0], args: [taskId, 0] }), - "colony-task-change-does-not-meet-signatures-required" + "task-change-wrong-num-sigs" ); }); @@ -1013,7 +1010,7 @@ contract("Tasks extension", accounts => { sigTypes: [0], args: [nonExistentTaskId, SPECIFICATION_HASH_UPDATED] }), - "colony-task-does-not-exist" + "task-does-not-exist" ); }); @@ -1029,7 +1026,7 @@ contract("Tasks extension", accounts => { sigTypes: [0], args: [taskId, SPECIFICATION_HASH_UPDATED] }), - "colony-task-does-not-exist" + "task-does-not-exist" ); }); @@ -1046,7 +1043,7 @@ contract("Tasks extension", accounts => { sigTypes: [0], args: [taskId, 0] }), - "colony-task-change-execution-failed" + "task-change-execution-failed" ); }); @@ -1087,7 +1084,7 @@ contract("Tasks extension", accounts => { sigTypes: [0, 0], args: [taskId, ADMIN, 1, 0] }), - "colony-task-role-assignment-execution-failed" + "olony-task-role-assignment-execution-failed" ); }); @@ -1139,7 +1136,7 @@ contract("Tasks extension", accounts => { args: [taskId, SPECIFICATION_HASH_UPDATED] }); - await checkErrorRevert(tasks.executeTaskChange(sigV, sigR, sigS, [0], 100, txData), "colony-task-change-non-zero-value"); + await checkErrorRevert(tasks.executeTaskChange(sigV, sigR, sigS, [0], 100, txData), "task-change-non-zero-value"); }); it("should fail to execute task change with a mismatched set of signature parts", async () => { @@ -1155,7 +1152,7 @@ contract("Tasks extension", accounts => { args: [taskId, SPECIFICATION_HASH_UPDATED] }); - await checkErrorRevert(tasks.executeTaskChange([sigV[0]], sigR, sigS, [0], 0, txData), "colony-task-change-signatures-count-do-not-match"); + await checkErrorRevert(tasks.executeTaskChange([sigV[0]], sigR, sigS, [0], 0, txData), "task-change-sig-count-no-match"); }); it("should fail to execute task change send for a task role assignment call (which should be using executeTaskRoleAssignment)", async () => { @@ -1171,7 +1168,7 @@ contract("Tasks extension", accounts => { args: [taskId, "0x29738B9BB168790211D84C99c4AEAd215c34D731"] }); - await checkErrorRevert(tasks.executeTaskChange(sigV, sigR, sigS, [0], 0, txData), "colony-task-change-is-role-assignment"); + await checkErrorRevert(tasks.executeTaskChange(sigV, sigR, sigS, [0], 0, txData), "task-change-is-role-assign"); }); it("should fail to execute task change with the wrong signatures, one signer", async () => { @@ -1187,7 +1184,7 @@ contract("Tasks extension", accounts => { args: [taskId, SPECIFICATION_HASH_UPDATED] }); - await checkErrorRevert(tasks.executeTaskChange(sigV, sigR, sigS, [0], 0, txData), "colony-task-signatures-do-not-match-reviewer-1"); + await checkErrorRevert(tasks.executeTaskChange(sigV, sigR, sigS, [0], 0, txData), "task-sigs-no-match-reviewer-1"); }); it("should fail to execute task change with the wrong signatures, two signers", async () => { @@ -1212,7 +1209,7 @@ contract("Tasks extension", accounts => { args: [taskId, SPECIFICATION_HASH_UPDATED] }); - await checkErrorRevert(tasks.executeTaskChange(sigV, sigR, sigS, [0, 0], 0, txData), "colony-task-signatures-do-not-match-reviewer-2"); + await checkErrorRevert(tasks.executeTaskChange(sigV, sigR, sigS, [0, 0], 0, txData), "task-sigs-no-match-reviewer-2"); }); }); @@ -1238,7 +1235,7 @@ contract("Tasks extension", accounts => { await forwardTime(90 * SECONDS_PER_DAY); await tasks.completeTask(taskId, { from: MANAGER }); - await checkErrorRevert(tasks.submitTaskDeliverable(taskId, DELIVERABLE_HASH), "colony-task-complete"); + await checkErrorRevert(tasks.submitTaskDeliverable(taskId, DELIVERABLE_HASH), "task-complete"); }); it("should fail if I try to submit work for a task that is finalized", async () => { @@ -1249,7 +1246,7 @@ contract("Tasks extension", accounts => { await submitDeliverableAndRatings({ tasks, taskId }); await tasks.finalizeTask(1, 0, taskId, { from: MANAGER }); - await checkErrorRevert(tasks.submitTaskDeliverable(taskId, DELIVERABLE_HASH, { from: WORKER }), "colony-task-complete"); + await checkErrorRevert(tasks.submitTaskDeliverable(taskId, DELIVERABLE_HASH, { from: WORKER }), "task-complete"); }); it("should succeed if I try to submit work for a task that is past its due date but not yet marked as complete", async () => { @@ -1268,7 +1265,7 @@ contract("Tasks extension", accounts => { await tasks.makeTask(1, 0, 1, 0, SPECIFICATION_HASH, 1, GLOBAL_SKILL_ID, 0, { from: MANAGER }); const taskId = await tasks.getTaskCount(); - await checkErrorRevert(tasks.submitTaskDeliverable(taskId.addn(1), DELIVERABLE_HASH), "colony-task-does-not-exist"); + await checkErrorRevert(tasks.submitTaskDeliverable(taskId.addn(1), DELIVERABLE_HASH), "task-does-not-exist"); }); it("should fail if I try to submit work twice", async () => { @@ -1278,7 +1275,7 @@ contract("Tasks extension", accounts => { await assignRoles({ tasks, taskId, manager: MANAGER, worker: WORKER }); await tasks.submitTaskDeliverable(taskId, DELIVERABLE_HASH, { from: WORKER }); - await checkErrorRevert(tasks.submitTaskDeliverable(taskId, SPECIFICATION_HASH, { from: WORKER }), "colony-task-complete"); + await checkErrorRevert(tasks.submitTaskDeliverable(taskId, SPECIFICATION_HASH, { from: WORKER }), "task-complete"); }); it("should fail if I try to mark a taske complete after work is submitted", async () => { @@ -1288,7 +1285,7 @@ contract("Tasks extension", accounts => { await assignRoles({ tasks, taskId, manager: MANAGER, worker: WORKER }); await tasks.submitTaskDeliverable(taskId, DELIVERABLE_HASH, { from: WORKER }); - await checkErrorRevert(tasks.completeTask(taskId, { from: MANAGER }), "colony-task-complete"); + await checkErrorRevert(tasks.completeTask(taskId, { from: MANAGER }), "task-complete"); }); it("should fail if I try to submit work if I'm not the assigned worker", async () => { @@ -1296,7 +1293,7 @@ contract("Tasks extension", accounts => { const taskId = await tasks.getTaskCount(); await assignRoles({ tasks, taskId, manager: MANAGER, worker: OTHER }); - await checkErrorRevert(tasks.submitTaskDeliverable(taskId, SPECIFICATION_HASH, { from: WORKER }), "colony-task-role-identity-mismatch"); + await checkErrorRevert(tasks.submitTaskDeliverable(taskId, SPECIFICATION_HASH, { from: WORKER }), "task-role-identity-mismatch"); }); it("should log a TaskDeliverableSubmitted event", async () => { @@ -1312,7 +1309,7 @@ contract("Tasks extension", accounts => { const taskId = await tasks.getTaskCount(); await assignRoles({ tasks, taskId, manager: MANAGER, worker: WORKER }); - await checkErrorRevert(tasks.completeTask(taskId, { from: MANAGER }), "colony-task-due-date-in-future"); + await checkErrorRevert(tasks.completeTask(taskId, { from: MANAGER }), "task-due-date-in-future"); }); }); @@ -1321,7 +1318,7 @@ contract("Tasks extension", accounts => { await tasks.makeTask(1, 0, 1, 0, SPECIFICATION_HASH, 1, GLOBAL_SKILL_ID, 0, { from: MANAGER }); const taskId = await tasks.getTaskCount(); - await checkErrorRevert(tasks.submitTaskWorkRating(taskId, WORKER_ROLE, RATING_2_SECRET, { from: EVALUATOR }), "colony-task-not-complete"); + await checkErrorRevert(tasks.submitTaskWorkRating(taskId, WORKER_ROLE, RATING_2_SECRET, { from: EVALUATOR }), "task-not-complete"); }); it("should fail if I try to evaluate twice", async () => { @@ -1331,10 +1328,7 @@ contract("Tasks extension", accounts => { await assignRoles({ tasks, taskId, manager: MANAGER, worker: WORKER }); await tasks.submitTaskDeliverableAndRating(taskId, DELIVERABLE_HASH, RATING_1_SECRET, { from: WORKER }); - await checkErrorRevert( - tasks.submitTaskWorkRating(taskId, MANAGER_ROLE, RATING_1_SECRET, { from: WORKER }), - "colony-task-rating-secret-already-exists" - ); + await checkErrorRevert(tasks.submitTaskWorkRating(taskId, MANAGER_ROLE, RATING_1_SECRET, { from: WORKER }), "task-secret-already-exists"); }); it("should fail if the wrong user tries to rate the wrong role", async () => { @@ -1345,9 +1339,9 @@ contract("Tasks extension", accounts => { await tasks.submitTaskDeliverable(taskId, DELIVERABLE_HASH, { from: WORKER }); const SECRET = soliditySha3("secret"); - await checkErrorRevert(tasks.submitTaskWorkRating(taskId, MANAGER_ROLE, SECRET, { from: OTHER }), "colony-user-cannot-rate-task-manager"); - await checkErrorRevert(tasks.submitTaskWorkRating(taskId, WORKER_ROLE, SECRET, { from: OTHER }), "colony-user-cannot-rate-task-worker"); - await checkErrorRevert(tasks.submitTaskWorkRating(taskId, EVALUATOR_ROLE, SECRET), "colony-unsupported-role-to-rate"); + await checkErrorRevert(tasks.submitTaskWorkRating(taskId, MANAGER_ROLE, SECRET, { from: OTHER }), "task-user-cannot-rate-manager"); + await checkErrorRevert(tasks.submitTaskWorkRating(taskId, WORKER_ROLE, SECRET, { from: OTHER }), "task-user-cannot-rate-worker"); + await checkErrorRevert(tasks.submitTaskWorkRating(taskId, EVALUATOR_ROLE, SECRET), "task-unsupported-role-to-rate"); }); it("can retreive rating secret information", async () => { @@ -1376,10 +1370,7 @@ contract("Tasks extension", accounts => { await tasks.submitTaskDeliverableAndRating(taskId, DELIVERABLE_HASH, RATING_1_SECRET, { from: WORKER }); await forwardTime(SECONDS_PER_DAY * 5 + 1); - await checkErrorRevert( - tasks.submitTaskWorkRating(taskId, WORKER_ROLE, RATING_2_SECRET, { from: MANAGER }), - "colony-task-rating-secret-submit-period-closed" - ); + await checkErrorRevert(tasks.submitTaskWorkRating(taskId, WORKER_ROLE, RATING_2_SECRET, { from: MANAGER }), "task-secret-submissions-closed"); }); it("should not allow a user to reveal after the deadline, with two secrets", async () => { @@ -1394,7 +1385,7 @@ contract("Tasks extension", accounts => { await forwardTime(SECONDS_PER_DAY * 5 + 1); await checkErrorRevert( tasks.revealTaskWorkRating(taskId, MANAGER_ROLE, MANAGER_RATING, RATING_1_SALT, { from: WORKER }), - "colony-task-rating-secret-reveal-period-closed" + "task-secret-reveal-closed" ); }); @@ -1409,7 +1400,7 @@ contract("Tasks extension", accounts => { await forwardTime(SECONDS_PER_DAY * 10 + 1); await checkErrorRevert( tasks.revealTaskWorkRating(taskId, MANAGER_ROLE, MANAGER_RATING, RATING_1_SALT, { from: WORKER }), - "colony-task-rating-secret-reveal-period-closed" + "task-secret-reveal-closed" ); }); @@ -1423,7 +1414,7 @@ contract("Tasks extension", accounts => { await checkErrorRevert( tasks.revealTaskWorkRating(taskId, MANAGER_ROLE, MANAGER_RATING, RATING_1_SALT, { from: WORKER }), - "colony-task-rating-secret-reveal-period-not-open" + "task-secret-reveal-not-open" ); }); @@ -1436,10 +1427,7 @@ contract("Tasks extension", accounts => { await tasks.submitTaskDeliverableAndRating(taskId, DELIVERABLE_HASH, soliditySha3(RATING_1_SALT, 3), { from: WORKER }); await tasks.submitTaskWorkRating(taskId, WORKER_ROLE, RATING_2_SECRET, { from: MANAGER }); - await checkErrorRevert( - tasks.revealTaskWorkRating(taskId, MANAGER_ROLE, 2, RATING_1_SALT, { from: WORKER }), - "colony-task-rating-secret-mismatch" - ); + await checkErrorRevert(tasks.revealTaskWorkRating(taskId, MANAGER_ROLE, 2, RATING_1_SALT, { from: WORKER }), "task-secret-mismatch"); }); it("should not allow a user to reveal a rating of None", async () => { @@ -1451,7 +1439,7 @@ contract("Tasks extension", accounts => { await tasks.submitTaskDeliverableAndRating(taskId, DELIVERABLE_HASH, soliditySha3(RATING_1_SALT, 0), { from: WORKER }); await tasks.submitTaskWorkRating(taskId, WORKER_ROLE, RATING_2_SECRET, { from: MANAGER }); - await checkErrorRevert(tasks.revealTaskWorkRating(taskId, MANAGER_ROLE, 0, RATING_1_SALT, { from: WORKER }), "colony-task-rating-missing"); + await checkErrorRevert(tasks.revealTaskWorkRating(taskId, MANAGER_ROLE, 0, RATING_1_SALT, { from: WORKER }), "task-rating-missing"); }); }); @@ -1484,7 +1472,7 @@ contract("Tasks extension", accounts => { await tasks.makeTask(1, 0, 1, 0, SPECIFICATION_HASH, 1, GLOBAL_SKILL_ID, 0, { from: MANAGER }); const taskId = await tasks.getTaskCount(); - await checkErrorRevert(tasks.finalizeTask(1, 0, taskId), "colony-task-not-complete"); + await checkErrorRevert(tasks.finalizeTask(1, 0, taskId), "task-not-complete"); }); it("should fail if the task work ratings have not been assigned and they still have time to be", async () => { @@ -1494,7 +1482,7 @@ contract("Tasks extension", accounts => { await assignRoles({ tasks, taskId, manager: MANAGER, worker: WORKER }); await tasks.submitTaskDeliverable(taskId, SPECIFICATION_HASH, { from: WORKER }); - await checkErrorRevert(tasks.finalizeTask(1, 0, taskId), "colony-task-ratings-not-closed"); + await checkErrorRevert(tasks.finalizeTask(1, 0, taskId), "task-ratings-not-closed"); }); it("should fail if the task work ratings have not been revealed and they still have time to be", async () => { @@ -1505,7 +1493,7 @@ contract("Tasks extension", accounts => { await tasks.submitTaskDeliverableAndRating(taskId, SPECIFICATION_HASH, RATING_1_SECRET, { from: WORKER }); await tasks.submitTaskWorkRating(taskId, WORKER_ROLE, RATING_2_SECRET, { from: MANAGER }); - await checkErrorRevert(tasks.finalizeTask(1, 0, taskId), "colony-task-ratings-not-closed"); + await checkErrorRevert(tasks.finalizeTask(1, 0, taskId), "task-ratings-not-closed"); }); it("should finalize if the rate and reveal period have elapsed", async () => { @@ -1528,7 +1516,7 @@ contract("Tasks extension", accounts => { await tasks.submitTaskDeliverableAndRating(taskId, SPECIFICATION_HASH, RATING_1_SECRET, { from: WORKER }); await tasks.submitTaskWorkRating(taskId, WORKER_ROLE, RATING_2_SECRET, { from: MANAGER }); - await checkErrorRevert(tasks.finalizeTask(1, 0, taskId), "colony-task-ratings-not-closed"); + await checkErrorRevert(tasks.finalizeTask(1, 0, taskId), "task-ratings-not-closed"); // Both secrets submitted, so we only have to wait for the reveal period to elapse await forwardTime(SECONDS_PER_DAY * 5 + 1); @@ -1589,7 +1577,7 @@ contract("Tasks extension", accounts => { await tasks.makeTask(1, 0, 1, 0, SPECIFICATION_HASH, 1, GLOBAL_SKILL_ID, 0, { from: MANAGER }); const taskId = await tasks.getTaskCount(); - await checkErrorRevert(tasks.finalizeTask(1, 0, taskId.addn(1)), "colony-task-does-not-exist"); + await checkErrorRevert(tasks.finalizeTask(1, 0, taskId.addn(1)), "task-does-not-exist"); }); it("should emit two negative reputation updates for a bad worker rating", async () => { @@ -1710,7 +1698,7 @@ contract("Tasks extension", accounts => { sigTypes: [0], args: [taskId.addn(1)] }), - "colony-task-does-not-exist" + "task-does-not-exist" ); }); }); @@ -1809,7 +1797,7 @@ contract("Tasks extension", accounts => { const taskId = await tasks.getTaskCount(); await checkErrorRevert( tasks.setAllTaskPayouts(taskId, ethers.constants.AddressZero, 5000, 1000, 98000, { from: OTHER }), - "colony-task-role-identity-mismatch" + "task-role-identity-mismatch" ); await tasks.setAllTaskPayouts(taskId, ethers.constants.AddressZero, 5000, 1000, 98000); @@ -1836,7 +1824,7 @@ contract("Tasks extension", accounts => { args: [taskId, WORKER] }); - await checkErrorRevert(tasks.setAllTaskPayouts(taskId, ethers.constants.AddressZero, 5000, 1000, 98000), "colony-funding-worker-already-set"); + await checkErrorRevert(tasks.setAllTaskPayouts(taskId, ethers.constants.AddressZero, 5000, 1000, 98000), "task-worker-already-set"); }); it("should not be able to set all payments at once if evaluator is assigned and is not the manager", async () => { @@ -1861,10 +1849,7 @@ contract("Tasks extension", accounts => { args: [taskId, EVALUATOR] }); - await checkErrorRevert( - tasks.setAllTaskPayouts(taskId, ethers.constants.AddressZero, 5000, 1000, 98000), - "colony-funding-evaluator-already-set" - ); + await checkErrorRevert(tasks.setAllTaskPayouts(taskId, ethers.constants.AddressZero, 5000, 1000, 98000), "task-evaluator-already-set"); }); it("should correctly return the current total payout", async () => {