From ee42d4d6d8057fb66d2f372d3764ed4931517650 Mon Sep 17 00:00:00 2001 From: Hrishikesh Huilgolkar Date: Mon, 26 Jul 2021 11:52:02 +0400 Subject: [PATCH] upgarde openZeppelin to 4.2.0 (#234) fixes #200 Co-authored-by: Skanda Bhat --- contracts/Core/ACL.sol | 7 +------ package-lock.json | 14 +++++++------- package.json | 2 +- test/ACL.js | 3 +-- test/BlockManager.js | 2 +- test/Parameters.js | 2 +- test/StakeManager.js | 4 ++-- test/VoteManager.js | 2 +- 8 files changed, 15 insertions(+), 21 deletions(-) diff --git a/contracts/Core/ACL.sol b/contracts/Core/ACL.sol index 1231c925..adce1772 100644 --- a/contracts/Core/ACL.sol +++ b/contracts/Core/ACL.sol @@ -8,9 +8,4 @@ contract ACL is AccessControl { constructor() { _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); } - - modifier onlyRole(bytes32 _hash) { - require(hasRole(_hash, msg.sender), "ACL: sender not authorized"); - _; - } -} \ No newline at end of file +} diff --git a/package-lock.json b/package-lock.json index 79efa5a1..85e480eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.1", "license": "ISC", "dependencies": { - "@openzeppelin/contracts": "^4.0.0", + "@openzeppelin/contracts": "^4.2.0", "@razor-network/merkle": "^0.6.0", "hardhat-abi-exporter": "^2.2.1", "jsonfile": "^6.1.0" @@ -901,9 +901,9 @@ "dev": true }, "node_modules/@openzeppelin/contracts": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.0.0.tgz", - "integrity": "sha512-UcIJl/vUVjTr3H1yYXZi7Sr2PlXzBEHVUJKOUlVyzyy0FI8oQCCy0Wx+BuK/fojdnmLeMvUk4KUvhKUybP+C7Q==" + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.2.0.tgz", + "integrity": "sha512-LD4NnkKpHHSMo5z9MvFsG4g1xxZUDqV3A3Futu3nvyfs4wPwXxqOgMaxOoa2PeyGL2VNeSlbxT54enbQzGcgJQ==" }, "node_modules/@razor-network/merkle": { "version": "0.6.0", @@ -13295,9 +13295,9 @@ } }, "@openzeppelin/contracts": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.0.0.tgz", - "integrity": "sha512-UcIJl/vUVjTr3H1yYXZi7Sr2PlXzBEHVUJKOUlVyzyy0FI8oQCCy0Wx+BuK/fojdnmLeMvUk4KUvhKUybP+C7Q==" + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.2.0.tgz", + "integrity": "sha512-LD4NnkKpHHSMo5z9MvFsG4g1xxZUDqV3A3Futu3nvyfs4wPwXxqOgMaxOoa2PeyGL2VNeSlbxT54enbQzGcgJQ==" }, "@razor-network/merkle": { "version": "0.6.0", diff --git a/package.json b/package.json index 6355b944..b8d91aee 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ }, "homepage": "https://github.com/razor-network/contracts#readme", "dependencies": { - "@openzeppelin/contracts": "^4.0.0", + "@openzeppelin/contracts": "^4.2.0", "@razor-network/merkle": "^0.6.0", "hardhat-abi-exporter": "^2.2.1", "jsonfile": "^6.1.0" diff --git a/test/ACL.js b/test/ACL.js index 586f0861..ab781905 100644 --- a/test/ACL.js +++ b/test/ACL.js @@ -14,7 +14,7 @@ describe('Access Control Test', async () => { let stakeManager; let rewardManager; let initializeContracts; - const expectedRevertMessage = 'ACL: sender not authorized'; + const expectedRevertMessage = 'AccessControl'; before(async () => { ({ @@ -485,7 +485,6 @@ describe('Access Control Test', async () => { }); it('Default Admin should able to change, New admin should able to grant/revoke', async () => { - const expectedRevertMessage = 'AccessControl: sender must be an admin to grant'; // Old admin should be able to grant admin role to another account await stakeManager.grantRole(DEFAULT_ADMIN_ROLE_HASH, signers[1].address); diff --git a/test/BlockManager.js b/test/BlockManager.js index aba01adc..3db615ff 100644 --- a/test/BlockManager.js +++ b/test/BlockManager.js @@ -82,7 +82,7 @@ describe('BlockManager', function () { voteManager.address, assetManager.address ); - await assertRevert(tx, 'ACL: sender not authorized'); + await assertRevert(tx, 'AccessControl'); }); it('should be able to initialize', async () => { diff --git a/test/Parameters.js b/test/Parameters.js index 492a4911..7e89c856 100644 --- a/test/Parameters.js +++ b/test/Parameters.js @@ -14,7 +14,7 @@ describe('Parameters contract Tests', async () => { let signers; let snapShotId; let parameters; - const expectedRevertMessage = 'ACL: sender not authorized'; + const expectedRevertMessage = 'AccessControl'; // parameters as initiliazed in Parameters contract const commit = toBigNumber('0'); diff --git a/test/StakeManager.js b/test/StakeManager.js index 1e38a416..db6bbd73 100644 --- a/test/StakeManager.js +++ b/test/StakeManager.js @@ -68,7 +68,7 @@ describe('StakeManager', function () { voteManager.address, parameters.address ); - await assertRevert(tx, 'ACL: sender not authorized'); + await assertRevert(tx, 'AccessControl'); }); it('should be able to initialize', async function () { @@ -731,7 +731,7 @@ describe('StakeManager', function () { const balanceContractBefore = await razor.balanceOf(stakeManager.address); const balanceAdminBefore = await razor.balanceOf(signers[1].address); const tx = stakeManager.connect(signers[1]).escape(signers[1].address); - await assertRevert(tx, 'VM Exception while processing transaction: reverted with reason string \'ACL: sender not authorized\''); + await assertRevert(tx, 'AccessControl'); const balanceContractAfter = await razor.balanceOf(stakeManager.address); const balanceAdminAfter = await razor.balanceOf(signers[1].address); diff --git a/test/VoteManager.js b/test/VoteManager.js index 3fcb5159..74289240 100644 --- a/test/VoteManager.js +++ b/test/VoteManager.js @@ -63,7 +63,7 @@ describe('VoteManager', function () { it('should not be able to initiliaze VoteManager contract without admin role', async () => { const tx = voteManager.connect(signers[1]).initialize(stakeManager.address, rewardManager.address, blockManager.address, parameters.address); - await assertRevert(tx, 'ACL: sender not authorized'); + await assertRevert(tx, 'AccessControl'); }); it('should be able to initialize', async function () {