Change admin role allocation in TimelockControler constructor (#3722)

Co-authored-by: Francisco <frangio.1@gmail.com>
This commit is contained in:
Hadrien Croubois
2022-09-23 16:58:56 +02:00
committed by GitHub
parent aa4b901788
commit 408055dfab
5 changed files with 45 additions and 18 deletions

View File

@ -1,5 +1,5 @@
const { BN, constants, expectEvent, expectRevert, time } = require('@openzeppelin/test-helpers');
const { ZERO_BYTES32 } = constants;
const { ZERO_ADDRESS, ZERO_BYTES32 } = constants;
const { expect } = require('chai');
@ -52,7 +52,7 @@ function genOperationBatch (targets, values, payloads, predecessor, salt) {
}
contract('TimelockController', function (accounts) {
const [ admin, proposer, canceller, executor, other ] = accounts;
const [ , admin, proposer, canceller, executor, other ] = accounts;
const TIMELOCK_ADMIN_ROLE = web3.utils.soliditySha3('TIMELOCK_ADMIN_ROLE');
const PROPOSER_ROLE = web3.utils.soliditySha3('PROPOSER_ROLE');
@ -65,7 +65,7 @@ contract('TimelockController', function (accounts) {
MINDELAY,
[ proposer ],
[ executor ],
{ from: admin },
admin,
);
expect(await this.mock.hasRole(CANCELLER_ROLE, proposer)).to.be.equal(true);
@ -102,6 +102,19 @@ contract('TimelockController', function (accounts) {
))).to.be.deep.equal([ false, false, true ]);
});
it('optional admin', async function () {
const mock = await TimelockController.new(
MINDELAY,
[ proposer ],
[ executor ],
ZERO_ADDRESS,
{ from: other },
);
expect(await mock.hasRole(TIMELOCK_ADMIN_ROLE, admin)).to.be.equal(false);
expect(await mock.hasRole(TIMELOCK_ADMIN_ROLE, other)).to.be.equal(false);
});
describe('methods', function () {
describe('operation hashing', function () {
it('hashOperation', async function () {