Implement suggestions from audit of AccessManager (#4178)

Co-authored-by: Francisco Giordano <fg@frang.io>
This commit is contained in:
Ernesto García
2023-04-22 20:40:49 +02:00
committed by GitHub
parent 7f5e91062e
commit a522187b50
3 changed files with 27 additions and 6 deletions

View File

@ -200,6 +200,7 @@ contract('AccessManager', function (accounts) {
describe('allowing', function () {
const group = '1';
const otherGroup = '2';
const groupMember = user1;
const selector = web3.eth.abi.encodeFunctionSignature('restrictedFunction()');
const otherSelector = web3.eth.abi.encodeFunctionSignature('otherRestrictedFunction()');
@ -289,6 +290,13 @@ contract('AccessManager', function (accounts) {
await this.manager.setContractModeClosed(this.managed.address, { from: admin });
await this.manager.setFunctionAllowedGroup(this.managed.address, [selector], group, false, { from: admin });
});
it('cannot allow nonexistent group', async function () {
await expectRevert(
this.manager.setFunctionAllowedGroup(this.managed.address, [selector], otherGroup, true, { from: admin }),
'AccessManager: unknown group',
);
});
});
describe('disallowing', function () {