Skip to content

Commit

Permalink
Function vs modifier means error less granular
Browse files Browse the repository at this point in the history
  • Loading branch information
area committed Sep 24, 2021
1 parent cf8ec37 commit 7812ae2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion contracts/colony/ColonyStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ contract ColonyStorage is CommonStorage, ColonyDataTypes, ColonyNetworkDataTypes
}

modifier onlyOwnExtension() {
require(isOwnExtension(msg.sender), "colony-must-be-extension");
require(isOwnExtension(msg.sender), "colony-must-be-own-extension");
_;
}

Expand Down
8 changes: 4 additions & 4 deletions test/contracts-network/colony-network-extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,13 @@ contract("Colony Network Extensions", (accounts) => {
it("does not allow non network-managed extensions to lock and unlock tokens", async () => {
const testVotingToken = await TestVotingToken.new();
await testVotingToken.install(colony.address);
await checkErrorRevert(testVotingToken.lockToken(), "colony-must-be-extension");
await checkErrorRevert(testVotingToken.unlockTokenForUser(ROOT, 0), "colony-must-be-extension");
await checkErrorRevert(testVotingToken.lockToken(), "colony-must-be-own-extension");
await checkErrorRevert(testVotingToken.unlockTokenForUser(ROOT, 0), "colony-must-be-own-extension");
});

it("does not allow users to lock and unlock tokens", async () => {
await checkErrorRevert(colony.lockToken(), "colony-sender-must-be-contract");
await checkErrorRevert(colony.unlockTokenForUser(ROOT, 0), "colony-sender-must-be-contract");
await checkErrorRevert(colony.lockToken(), "colony-must-be-own-extension");
await checkErrorRevert(colony.unlockTokenForUser(ROOT, 0), "colony-must-be-own-extension");
});

it("does not allow a colony to unlock a lock placed by another colony", async () => {
Expand Down

0 comments on commit 7812ae2

Please sign in to comment.