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

Add check for ecrecover in ColonyTask #1109

Merged
merged 1 commit into from
Dec 15, 2022
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
1 change: 0 additions & 1 deletion contracts/colony/Colony.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import "./ColonyStorage.sol";

contract Colony is BasicMetaTransaction, Multicall, ColonyStorage, PatriciaTreeProofs {

// V11: Hazel Lightweight Spaceship
// This function, exactly as defined, is used in build scripts. Take care when updating.
// Version number should be upped with every change in Colony or its dependency contracts or libraries.
function version() public pure returns (uint256 colonyVersion) { return 11; }
Expand Down
1 change: 1 addition & 0 deletions contracts/colony/ColonyTask.sol
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ contract ColonyTask is ColonyStorage {
}

reviewerAddresses[i] = ecrecover(txHash, _sigV[i], _sigR[i], _sigS[i]);
require(reviewerAddresses[i] != address(0), "colony-task-invalid-signature");
}
return reviewerAddresses;
}
Expand Down
16 changes: 16 additions & 0 deletions test/contracts-network/colony-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,22 @@ contract("ColonyTask", (accounts) => {
await checkErrorRevert(colony.executeTaskChange([sigV[0]], sigR, sigS, [0], 0, txData), "colony-task-change-signatures-count-do-not-match");
});

it("should fail to execute task change with a bad signature and only one of the relevant roles set", async () => {
const taskId = await makeTask({ colony });
const { sigR, sigS, txData } = await getSigsAndTransactionData({
colony,
taskId,
functionName: "setTaskDueDate",
signers: [MANAGER],
sigTypes: [0],
args: [taskId, "1"],
});

// Make the signature bad
const sigV = [11];
await checkErrorRevert(colony.executeTaskChange(sigV, sigR, sigS, [0], 0, txData), "colony-task-invalid-signature");
});

it("should fail to execute task change send for a task role assignment call (which should be using executeTaskRoleAssignment)", async () => {
const taskId = await makeTask({ colony });
const { sigV, sigR, sigS, txData } = await getSigsAndTransactionData({
Expand Down