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

Merge release-v4.9 branch #4352

Merged
merged 23 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2d2c5f3
Start release candidate
github-actions[bot] May 9, 2023
43eb8d1
Specify changeset PRs manually
frangio May 9, 2023
17cf519
Release v4.9.0 (rc) (#4228)
github-actions[bot] May 9, 2023
f214e47
Disable code size warnings on exposed contracts
frangio May 9, 2023
46d5a87
Fix spelling error in CHANGELOG.md (#4232)
Amxx May 10, 2023
9673c56
Clean up pending admin schedule on renounce in DefaultAdminRules (#4230)
frangio May 10, 2023
652ae92
Prevent attempt to publish to npm (#4239)
frangio May 11, 2023
e0fe936
Fix bug allowing anyone to cancel an admin renounce (#4238)
Amxx May 11, 2023
a43069e
Reduce frequency of version comment updates (#4244)
frangio May 12, 2023
4f7047c
Release v4.9.0 (rc) (#4243)
github-actions[bot] May 17, 2023
813cc2b
Exit release candidate
github-actions[bot] May 23, 2023
54b3f14
Release v4.9.0 (#4272)
github-actions[bot] May 23, 2023
a6e2671
Fix release merge script (#4273)
frangio May 23, 2023
8198205
Fix doc MyGovernor example doesn't compile (#4282)
qiweiii Jun 1, 2023
4e6deb3
Fix import substitution for docs examples
frangio Jun 1, 2023
fa3a30a
Fix typo in crosschain.adoc
JulissaDantes Jun 2, 2023
33ff9b0
Merge pull request from GHSA-5h3x-9wvq-w4m2
Amxx Jun 7, 2023
281550b
Release v4.9.1 (#4321)
github-actions[bot] Jun 7, 2023
ded8c9e
Update index.adoc (#4336)
zackrw Jun 13, 2023
9fb37a7
Merge branch 'master' into merge/release-v4.9
ernestognw Jun 14, 2023
f9199dc
Remove duplicate tests
ernestognw Jun 14, 2023
fffe013
Revert wrong conflict resolution
ernestognw Jun 14, 2023
ec47548
Update CHANGELOG.md
ernestognw Jun 14, 2023
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
Prev Previous commit
Next Next commit
Fix bug allowing anyone to cancel an admin renounce (#4238)
Co-authored-by: Francisco Giordano <fg@frang.io>
(cherry picked from commit 3ec4307)
  • Loading branch information
Amxx authored and frangio committed May 11, 2023
commit e0fe9367297a8ceba5da091be94b738e174b8f05
4 changes: 2 additions & 2 deletions contracts/access/AccessControlDefaultAdminRules.sol
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ abstract contract AccessControlDefaultAdminRules is IAccessControlDefaultAdminRu
* non-administrated role.
*/
function renounceRole(bytes32 role, address account) public virtual override(AccessControl, IAccessControl) {
if (role == DEFAULT_ADMIN_ROLE) {
if (role == DEFAULT_ADMIN_ROLE && account == defaultAdmin()) {
(address newDefaultAdmin, uint48 schedule) = pendingDefaultAdmin();
require(
newDefaultAdmin == address(0) && _isScheduleSet(schedule) && _hasSchedulePassed(schedule),
Expand Down Expand Up @@ -138,7 +138,7 @@ abstract contract AccessControlDefaultAdminRules is IAccessControlDefaultAdminRu
* @dev See {AccessControl-_revokeRole}.
*/
function _revokeRole(bytes32 role, address account) internal virtual override {
if (role == DEFAULT_ADMIN_ROLE && account == _currentDefaultAdmin) {
if (role == DEFAULT_ADMIN_ROLE && account == defaultAdmin()) {
delete _currentDefaultAdmin;
}
super._revokeRole(role, account);
Expand Down
24 changes: 14 additions & 10 deletions test/access/AccessControl.behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,14 +621,15 @@ function shouldBehaveLikeAccessControlDefaultAdminRules(errorPrefix, delay, defa
});

describe('renounces admin', function () {
let expectedSchedule;
let delayPassed;
let delayNotPassed;

beforeEach(async function () {
await this.accessControl.beginDefaultAdminTransfer(constants.ZERO_ADDRESS, { from: defaultAdmin });
delayPassed = web3.utils
.toBN(await time.latest())
.add(delay)
.addn(1);
expectedSchedule = web3.utils.toBN(await time.latest()).add(delay);
delayNotPassed = expectedSchedule;
delayPassed = expectedSchedule.addn(1);
});

it('reverts if caller is not default admin', async function () {
Expand All @@ -639,6 +640,15 @@ function shouldBehaveLikeAccessControlDefaultAdminRules(errorPrefix, delay, defa
);
});

it("renouncing the admin role when not an admin doesn't affect the schedule", async function () {
await time.setNextBlockTimestamp(delayPassed);
await this.accessControl.renounceRole(DEFAULT_ADMIN_ROLE, other, { from: other });

const { newAdmin, schedule } = await this.accessControl.pendingDefaultAdmin();
expect(newAdmin).to.equal(constants.ZERO_ADDRESS);
expect(schedule).to.be.bignumber.equal(expectedSchedule);
});

it('keeps defaultAdmin consistent with hasRole if another non-defaultAdmin user renounces the DEFAULT_ADMIN_ROLE', async function () {
await time.setNextBlockTimestamp(delayPassed);

Expand Down Expand Up @@ -677,12 +687,6 @@ function shouldBehaveLikeAccessControlDefaultAdminRules(errorPrefix, delay, defa
});

describe('schedule not passed', function () {
let delayNotPassed;

beforeEach(function () {
delayNotPassed = delayPassed.subn(1);
});

for (const [fromSchedule, tag] of [
[-1, 'less'],
[0, 'equal'],
Expand Down