diff --git a/contracts/Core/storage/Constants.sol b/contracts/Core/storage/Constants.sol index dac938fa..0899727c 100644 --- a/contracts/Core/storage/Constants.sol +++ b/contracts/Core/storage/Constants.sol @@ -33,12 +33,6 @@ contract Constants { // keccak256("BLOCK_CONFIRMER_ROLE") bytes32 public constant BLOCK_CONFIRMER_ROLE = 0x18797bc7973e1dadee1895be2f1003818e30eae3b0e7a01eb9b2e66f3ea2771f; - // keccak256("COLLECTION_CONFIRMER_ROLE") - bytes32 public constant COLLECTION_CONFIRMER_ROLE = 0xa1d2ec18e7ea6241ef0566da3d2bc59cc059592990e56680abdc7031155a0c28; - - // keccak256("STAKER_ACTIVITY_UPDATER_ROLE") - bytes32 public constant STAKER_ACTIVITY_UPDATER_ROLE = 0x4cd3070aaa07d03ab33731cbabd0cb27eb9e074a9430ad006c96941d71b77ece; - // keccak256("STAKE_MODIFIER_ROLE") bytes32 public constant STAKE_MODIFIER_ROLE = 0xdbaaaff2c3744aa215ebd99971829e1c1b728703a0bf252f96685d29011fc804; diff --git a/migrations/src/postDeploymentSetup.js b/migrations/src/postDeploymentSetup.js index 969109d0..ea980509 100644 --- a/migrations/src/postDeploymentSetup.js +++ b/migrations/src/postDeploymentSetup.js @@ -35,12 +35,6 @@ module.exports = async () => { // keccak256("BLOCK_CONFIRMER_ROLE") const BLOCK_CONFIRMER_ROLE = '0x18797bc7973e1dadee1895be2f1003818e30eae3b0e7a01eb9b2e66f3ea2771f'; - // keccak256("COLLECTION_CONFIRMER_ROLE") - const COLLECTION_CONFIRMER_ROLE = '0xa1d2ec18e7ea6241ef0566da3d2bc59cc059592990e56680abdc7031155a0c28'; - - // keccak256("STAKER_ACTIVITY_UPDATER_ROLE") - const STAKER_ACTIVITY_UPDATER_ROLE = '0x4cd3070aaa07d03ab33731cbabd0cb27eb9e074a9430ad006c96941d71b77ece'; - // keccak256("STAKE_MODIFIER_ROLE") const STAKE_MODIFIER_ROLE = '0xdbaaaff2c3744aa215ebd99971829e1c1b728703a0bf252f96685d29011fc804'; @@ -120,12 +114,10 @@ module.exports = async () => { pendingTransactions.push(await delegator.grantRole(GOVERNANCE_ROLE, governanceAddress)); pendingTransactions.push(await randomNoManager.grantRole(GOVERNANCE_ROLE, governanceAddress)); - pendingTransactions.push(await collectionManager.grantRole(COLLECTION_CONFIRMER_ROLE, blockManagerAddress)); pendingTransactions.push(await blockManager.grantRole(BLOCK_CONFIRMER_ROLE, voteManagerAddress)); pendingTransactions.push(await rewardManager.grantRole(REWARD_MODIFIER_ROLE, blockManagerAddress)); pendingTransactions.push(await rewardManager.grantRole(REWARD_MODIFIER_ROLE, voteManagerAddress)); pendingTransactions.push(await rewardManager.grantRole(REWARD_MODIFIER_ROLE, stakeManagerAddress)); - pendingTransactions.push(await stakeManager.grantRole(STAKER_ACTIVITY_UPDATER_ROLE, voteManagerAddress)); pendingTransactions.push(await stakeManager.grantRole(STAKE_MODIFIER_ROLE, rewardManagerAddress)); pendingTransactions.push(await stakeManager.grantRole(STAKE_MODIFIER_ROLE, blockManagerAddress)); pendingTransactions.push(await stakeManager.grantRole(STAKE_MODIFIER_ROLE, voteManagerAddress)); diff --git a/test/ACL.js b/test/ACL.js index acdf1d4e..63262de3 100644 --- a/test/ACL.js +++ b/test/ACL.js @@ -2,8 +2,6 @@ const { assert, expect } = require('chai'); const { DEFAULT_ADMIN_ROLE_HASH, BLOCK_CONFIRMER_ROLE, - COLLECTION_CONFIRMER_ROLE, - STAKER_ACTIVITY_UPDATER_ROLE, STAKE_MODIFIER_ROLE, REWARD_MODIFIER_ROLE, COLLECTION_MODIFIER_ROLE, @@ -61,17 +59,9 @@ describe('Access Control Test', async () => { const epoch = getEpoch(); await assertRevert(blockManager.confirmPreviousEpochBlock(epoch), expectedRevertMessage); - // Checking if AssetConfirmer can access it - await blockManager.grantRole(COLLECTION_CONFIRMER_ROLE, signers[0].address); - await assertRevert(blockManager.confirmPreviousEpochBlock(epoch), expectedRevertMessage); - // Checking if StakeModifier can access it await blockManager.grantRole(STAKE_MODIFIER_ROLE, signers[0].address); await assertRevert(blockManager.confirmPreviousEpochBlock(epoch), expectedRevertMessage); - - // Checking if StakerActivityUpdater can access it - await blockManager.grantRole(STAKER_ACTIVITY_UPDATER_ROLE, signers[0].address); - await assertRevert(blockManager.confirmPreviousEpochBlock(epoch), expectedRevertMessage); }); it('confirmPreviousEpochBlock() should be accessable by BlockConfirmer', async () => { @@ -89,17 +79,9 @@ describe('Access Control Test', async () => { // Checking if Anyone can access it await assertRevert(stakeManager.slash(1, 1, signers[2].address), expectedRevertMessage); - // Checking if AssetConfirmer can access it - await rewardManager.grantRole(COLLECTION_CONFIRMER_ROLE, signers[0].address); - await assertRevert(stakeManager.slash(1, 1, signers[2].address), expectedRevertMessage); - // Checking if BlockConfirmer can access it await rewardManager.grantRole(BLOCK_CONFIRMER_ROLE, signers[0].address); await assertRevert(stakeManager.slash(1, 1, signers[2].address), expectedRevertMessage); - - // Checking if StakerActivityUpdater can access it - await rewardManager.grantRole(STAKER_ACTIVITY_UPDATER_ROLE, signers[0].address); - await assertRevert(stakeManager.slash(1, 1, signers[2].address), expectedRevertMessage); }); it('slash() should be accessable by StakeModifier', async () => { @@ -113,17 +95,9 @@ describe('Access Control Test', async () => { // Checking if Anyone can access it await assertRevert(rewardManager.giveBlockReward(1, 1), expectedRevertMessage); - // Checking if AssetConfirmer can access it - await rewardManager.grantRole(await COLLECTION_CONFIRMER_ROLE, signers[0].address); - await assertRevert(rewardManager.giveBlockReward(1, 1), expectedRevertMessage); - // Checking if BlockConfirmer can access it await rewardManager.grantRole(BLOCK_CONFIRMER_ROLE, signers[0].address); await assertRevert(rewardManager.giveBlockReward(1, 1), expectedRevertMessage); - - // Checking if StakerActivityUpdater can access it - await rewardManager.grantRole(STAKER_ACTIVITY_UPDATER_ROLE, signers[0].address); - await assertRevert(rewardManager.giveBlockReward(1, 1), expectedRevertMessage); }); it('giveBlockReward() should be accessable by RewardModifier', async () => { @@ -161,17 +135,9 @@ describe('Access Control Test', async () => { // Checking if Anyone can access it await assertRevert(rewardManager.givePenalties(1, 1), expectedRevertMessage); - // Checking if AssetConfirmer can access it - await rewardManager.grantRole(await COLLECTION_CONFIRMER_ROLE, signers[0].address); - await assertRevert(rewardManager.givePenalties(1, 1), expectedRevertMessage); - // Checking if BlockConfirmer can access it await rewardManager.grantRole(BLOCK_CONFIRMER_ROLE, signers[0].address); await assertRevert(rewardManager.givePenalties(1, 1), expectedRevertMessage); - - // Checking if StakerActivityUpdater can access it - await rewardManager.grantRole(STAKER_ACTIVITY_UPDATER_ROLE, signers[0].address); - await assertRevert(rewardManager.givePenalties(1, 1), expectedRevertMessage); }); it('givePenalties() should be accessable by RewardModifier', async () => { @@ -185,18 +151,10 @@ describe('Access Control Test', async () => { // Checking if Anyone can access it await assertRevert(stakeManager.setStakerStake(1, 1, 1, 10, 10), expectedRevertMessage); - // Checking if AssetConfirmer can access it - await stakeManager.grantRole(await COLLECTION_CONFIRMER_ROLE, signers[0].address); - await assertRevert(stakeManager.setStakerStake(1, 1, 1, 10, 10), expectedRevertMessage); - // Checking if BlockConfirmer can access it await stakeManager.grantRole(BLOCK_CONFIRMER_ROLE, signers[0].address); await assertRevert(stakeManager.setStakerStake(1, 1, 1, 10, 10), expectedRevertMessage); - // Checking if StakerActivityUpdater can access it - await stakeManager.grantRole(STAKER_ACTIVITY_UPDATER_ROLE, signers[0].address); - await assertRevert(stakeManager.setStakerStake(1, 1, 1, 10, 10), expectedRevertMessage); - // Checking if RewardModifier can access it await stakeManager.grantRole(REWARD_MODIFIER_ROLE, signers[0].address); await assertRevert(stakeManager.setStakerStake(1, 1, 1, 10, 10), expectedRevertMessage); @@ -220,10 +178,6 @@ describe('Access Control Test', async () => { // Checking if StakeModifier can access it await collectionManager.grantRole(STAKE_MODIFIER_ROLE, signers[0].address); await assertRevert(collectionManager.createJob(25, 0, 0, 'http://testurl.com/1', 'selector/1', 'test1'), expectedRevertMessage); - - // Checking if StakerActivityUpdater can access it - await collectionManager.grantRole(STAKER_ACTIVITY_UPDATER_ROLE, signers[0].address); - await assertRevert(collectionManager.createJob(25, 0, 0, 'http://testurl.com/1', 'selector/1', 'test1'), expectedRevertMessage); }); it('createJob() should be accessable by only AssetCreator', async () => { @@ -245,10 +199,6 @@ describe('Access Control Test', async () => { // Checking if StakeModifier can access it await collectionManager.grantRole(STAKE_MODIFIER_ROLE, signers[0].address); await assertRevert(collectionManager.updateJob(1, 25, 2, 0, 'http://testurl.com/2', 'selector/2'), expectedRevertMessage); - - // Checking if StakerActivityUpdater can access it - await collectionManager.grantRole(STAKER_ACTIVITY_UPDATER_ROLE, signers[0].address); - await assertRevert(collectionManager.updateJob(1, 25, 2, 0, 'http://testurl.com/2', 'selector/2'), expectedRevertMessage); }); it('updateJob() should be accessable by only AssetCreator', async () => { @@ -273,10 +223,6 @@ describe('Access Control Test', async () => { // Checking if StakeModifier can access it await collectionManager.grantRole(STAKE_MODIFIER_ROLE, signers[0].address); await assertRevert(collectionManager.setCollectionStatus(true, 1), expectedRevertMessage); - - // Checking if StakerActivityUpdater can access it - await collectionManager.grantRole(STAKER_ACTIVITY_UPDATER_ROLE, signers[0].address); - await assertRevert(collectionManager.setCollectionStatus(true, 1), expectedRevertMessage); }); it('setCollectionStatus() should be accessable by only AssetCreator', async () => { @@ -306,10 +252,6 @@ describe('Access Control Test', async () => { // Checking if StakeModifier can access it await collectionManager.grantRole(STAKE_MODIFIER_ROLE, signers[0].address); await assertRevert(collectionManager.createCollection(500, 1, 1, [1, 2], 'test'), expectedRevertMessage); - - // Checking if StakerActivityUpdater can access it - await collectionManager.grantRole(STAKER_ACTIVITY_UPDATER_ROLE, signers[0].address); - await assertRevert(collectionManager.createCollection(500, 1, 1, [1, 2], 'test'), expectedRevertMessage); }); it('createCollection() should be accessable by only AssetCreator', async () => { @@ -338,10 +280,6 @@ describe('Access Control Test', async () => { // Checking if StakeModifier can access it await collectionManager.grantRole(STAKE_MODIFIER_ROLE, signers[0].address); await assertRevert(collectionManager.updateCollection(3, 500, 2, -2, [1, 2]), expectedRevertMessage); - - // Checking if StakerActivityUpdater can access it - await collectionManager.grantRole(STAKER_ACTIVITY_UPDATER_ROLE, signers[0].address); - await assertRevert(collectionManager.updateCollection(3, 500, 2, -2, [1, 2]), expectedRevertMessage); }); it('updateCollection() should be accessable by only AssetModifier', async () => { @@ -404,12 +342,6 @@ describe('Access Control Test', async () => { // New admin should be able to revoke admin access from old admin await stakeManager.connect(signers[1]).revokeRole(DEFAULT_ADMIN_ROLE_HASH, signers[0].address); - - // Old admin should not able to assign roles anymore - await assertRevert(stakeManager.grantRole(STAKER_ACTIVITY_UPDATER_ROLE, signers[0].address), expectedRevertMessage); - - // New admin should be able to assign roles - await stakeManager.connect(signers[1]).grantRole(STAKER_ACTIVITY_UPDATER_ROLE, signers[0].address); }); it('Only Admin should be able to call updateAddress in Delegator', async () => { assert(await delegator.connect(signers[0]).updateAddress(signers[2].address)); diff --git a/test/helpers/constants.js b/test/helpers/constants.js index 330e49da..dff90908 100644 --- a/test/helpers/constants.js +++ b/test/helpers/constants.js @@ -26,12 +26,6 @@ const MATURITIES = [50, 70, 86, 100, 111, 122, 132, 141, 150, 158, // keccak256("BLOCK_CONFIRMER_ROLE") const BLOCK_CONFIRMER_ROLE = '0x18797bc7973e1dadee1895be2f1003818e30eae3b0e7a01eb9b2e66f3ea2771f'; -// keccak256("COLLECTION_CONFIRMER_ROLE") -const COLLECTION_CONFIRMER_ROLE = '0xa1d2ec18e7ea6241ef0566da3d2bc59cc059592990e56680abdc7031155a0c28'; - -// keccak256("STAKER_ACTIVITY_UPDATER_ROLE") -const STAKER_ACTIVITY_UPDATER_ROLE = '0x4cd3070aaa07d03ab33731cbabd0cb27eb9e074a9430ad006c96941d71b77ece'; - // keccak256("STAKE_MODIFIER_ROLE") const STAKE_MODIFIER_ROLE = '0xdbaaaff2c3744aa215ebd99971829e1c1b728703a0bf252f96685d29011fc804'; @@ -80,8 +74,6 @@ const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'; module.exports = { DEFAULT_ADMIN_ROLE_HASH, BLOCK_CONFIRMER_ROLE, - COLLECTION_CONFIRMER_ROLE, - STAKER_ACTIVITY_UPDATER_ROLE, STAKE_MODIFIER_ROLE, SECRETS_MODIFIER_ROLE, REWARD_MODIFIER_ROLE, diff --git a/test/helpers/testSetup.js b/test/helpers/testSetup.js index 94e0fd6a..f9d894f4 100644 --- a/test/helpers/testSetup.js +++ b/test/helpers/testSetup.js @@ -2,10 +2,8 @@ const { BigNumber } = ethers; const initialSupply = (BigNumber.from(10).pow(BigNumber.from(27))); const { BLOCK_CONFIRMER_ROLE, - STAKER_ACTIVITY_UPDATER_ROLE, STAKE_MODIFIER_ROLE, REWARD_MODIFIER_ROLE, - COLLECTION_CONFIRMER_ROLE, REGISTRY_MODIFIER_ROLE, GOVERNANCE_ROLE, PAUSE_ROLE, @@ -62,13 +60,11 @@ const setupContracts = async () => { governance.initialize(blockManager.address, rewardManager.address, stakeManager.address, voteManager.address, collectionManager.address, randomNoManager.address), - collectionManager.grantRole(COLLECTION_CONFIRMER_ROLE, blockManager.address), blockManager.grantRole(BLOCK_CONFIRMER_ROLE, voteManager.address), stakeManager.grantRole(PAUSE_ROLE, signers[0].address), rewardManager.grantRole(REWARD_MODIFIER_ROLE, blockManager.address), rewardManager.grantRole(REWARD_MODIFIER_ROLE, voteManager.address), rewardManager.grantRole(REWARD_MODIFIER_ROLE, stakeManager.address), - stakeManager.grantRole(STAKER_ACTIVITY_UPDATER_ROLE, voteManager.address), stakeManager.grantRole(STAKE_MODIFIER_ROLE, rewardManager.address), stakeManager.grantRole(STAKE_MODIFIER_ROLE, blockManager.address), stakeManager.grantRole(STAKE_MODIFIER_ROLE, voteManager.address),