From 693ff347d87746e95fac1340b4e24201ecac101b Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Fri, 28 Jul 2023 12:05:21 +0200 Subject: [PATCH 01/32] first batch of restructuring --- src/modules/MetadataManager.sol | 6 ++-- src/modules/base/Module.sol | 17 ++++++++-- src/modules/logicModule/BountyManager.sol | 33 +++++++------------ src/modules/logicModule/IBountyManager.sol | 3 -- src/modules/logicModule/MilestoneManager.sol | 18 +++++----- .../logicModule/RecurringPaymentManager.sol | 4 +-- .../StreamingPaymentProcessor.sol | 4 +-- src/proposal/Proposal.sol | 14 ++++---- src/proposal/base/ModuleManager.sol | 2 +- test/e2e/BountyManagerLifecycle.t.sol | 1 - test/e2e/CreateNewProposal.t.sol | 2 +- test/modules/logicModule/BountyManager.t.sol | 28 ++++++++-------- .../logicModule/RecurringPaymentManager.t.sol | 4 +-- .../StreamingPaymentProcessor.t.sol | 4 +-- 14 files changed, 69 insertions(+), 71 deletions(-) diff --git a/src/modules/MetadataManager.sol b/src/modules/MetadataManager.sol index 58479493d..f107ab618 100644 --- a/src/modules/MetadataManager.sol +++ b/src/modules/MetadataManager.sol @@ -74,7 +74,7 @@ contract MetadataManager is IMetadataManager, Module { function setManagerMetadata(ManagerMetadata calldata managerMetadata_) external - onlyAuthorizedOrManager + onlyProposalOwnerOrManager { _setManagerMetadata(managerMetadata_); } @@ -92,7 +92,7 @@ contract MetadataManager is IMetadataManager, Module { function setProposalMetadata(ProposalMetadata calldata proposalMetadata_) public - onlyAuthorizedOrManager + onlyProposalOwnerOrManager { _setProposalMetadata(proposalMetadata_); } @@ -112,7 +112,7 @@ contract MetadataManager is IMetadataManager, Module { function setTeamMetadata(MemberMetadata[] calldata teamMetadata_) external - onlyAuthorizedOrManager + onlyProposalOwnerOrManager { _setTeamMetadata(teamMetadata_); } diff --git a/src/modules/base/Module.sol b/src/modules/base/Module.sol index 7f2931154..e2516aa1b 100644 --- a/src/modules/base/Module.sol +++ b/src/modules/base/Module.sol @@ -11,6 +11,7 @@ import {LibMetadata} from "src/modules/lib/LibMetadata.sol"; // Internal Interfaces import {IModule, IProposal} from "src/modules/base/IModule.sol"; import {IAuthorizer} from "src/modules/authorizer/IAuthorizer.sol"; +import {IRoleAuthorizer} from "src/modules/authorizer/IRoleAuthorizer.sol"; /** * @title Module @@ -60,7 +61,7 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { /// @notice Modifier to guarantee function is only callable by addresses /// authorized via Proposal. - modifier onlyAuthorized() { + modifier onlyProposalOwner() { IAuthorizer authorizer = __Module_proposal.authorizer(); if (!authorizer.isAuthorized(_msgSender())) { revert Module__CallerNotAuthorized(); @@ -70,7 +71,7 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { /// @notice Modifier to guarantee function is only callable by either /// addresses authorized via Proposal or the Proposal's manager. - modifier onlyAuthorizedOrManager() { + modifier onlyProposalOwnerOrManager() { IAuthorizer authorizer = __Module_proposal.authorizer(); if ( !authorizer.isAuthorized(_msgSender()) @@ -81,6 +82,18 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { _; } + //@todo Reminder that this will be moved into the Module Contract at a later point of time + modifier onlyModuleRole(uint8 roleId) { + if ( + !IRoleAuthorizer(address(__Module_proposal.authorizer())) + .isAuthorized(roleId, _msgSender()) + ) { + //revert Module__BountyManager__OnlyRole(roleId, address(this)); + revert Module__CallerNotAuthorized(); + } + _; + } + /// @notice Modifier to guarantee function is only callable by the proposal. /// @dev onlyProposal functions MUST only access the module's storage, i.e. /// `__Module_` variables. diff --git a/src/modules/logicModule/BountyManager.sol b/src/modules/logicModule/BountyManager.sol index 0e35fa47a..f05ef1c53 100644 --- a/src/modules/logicModule/BountyManager.sol +++ b/src/modules/logicModule/BountyManager.sol @@ -40,17 +40,6 @@ contract BountyManager is IBountyManager, Module, PaymentClient { //-------------------------------------------------------------------------- // Modifiers - //@todo Reminder that this will be moved into the Module Contract at a later point of time - modifier onlyRole(uint8 roleId) { - if ( - !IRoleAuthorizer(address(__Module_proposal.authorizer())) - .isAuthorized(roleId, _msgSender()) - ) { - revert Module__BountyManager__OnlyRole(roleId, address(this)); - } - _; - } - modifier onlyClaimContributor(uint claimId) { address sender = _msgSender(); Contributor[] memory contribs = _claimRegistry[claimId].contributors; @@ -274,7 +263,7 @@ contract BountyManager is IBountyManager, Module, PaymentClient { bytes calldata details ) external - onlyRole(uint8(Roles.BountyAdmin)) + onlyModuleRole(uint8(Roles.BountyAdmin)) validPayoutAmounts(minimumPayoutAmount, maximumPayoutAmount) returns (uint id) { @@ -300,7 +289,7 @@ contract BountyManager is IBountyManager, Module, PaymentClient { /// @inheritdoc IBountyManager function updateBounty(uint bountyId, bytes calldata details) external - onlyRole(uint8(Roles.BountyAdmin)) + onlyModuleRole(uint8(Roles.BountyAdmin)) validBountyId(bountyId) { _bountyRegistry[bountyId].details = details; @@ -311,7 +300,7 @@ contract BountyManager is IBountyManager, Module, PaymentClient { /// @inheritdoc IBountyManager function lockBounty(uint bountyId) external - onlyRole(uint8(Roles.BountyAdmin)) + onlyModuleRole(uint8(Roles.BountyAdmin)) validBountyId(bountyId) notClaimed(bountyId) { @@ -327,7 +316,7 @@ contract BountyManager is IBountyManager, Module, PaymentClient { bytes calldata details ) external - onlyRole(uint8(Roles.ClaimAdmin)) + onlyModuleRole(uint8(Roles.ClaimAdmin)) validBountyId(bountyId) notClaimed(bountyId) returns (uint id) @@ -414,7 +403,7 @@ contract BountyManager is IBountyManager, Module, PaymentClient { /// @inheritdoc IBountyManager function verifyClaim(uint claimId, uint bountyId) external - onlyRole(uint8(Roles.VerifyAdmin)) + onlyModuleRole(uint8(Roles.VerifyAdmin)) validClaimId(claimId) validBountyId(bountyId) claimBelongingToBounty(claimId, bountyId) @@ -466,7 +455,7 @@ contract BountyManager is IBountyManager, Module, PaymentClient { // Role Functions /// @inheritdoc IBountyManager - function grantBountyAdminRole(address addr) external onlyAuthorized { + function grantBountyAdminRole(address addr) external onlyProposalOwner { //@todo Will be removed in the future and moved to the authorizer directly IRoleAuthorizer roleAuthorizer = IRoleAuthorizer(address(__Module_proposal.authorizer())); //@todo Cast to IRoleAuthorizer wont be necessary as soon as the IAuthorizer Interface in Proposal is replaced by IRoleAuthorizer, this is the same for the other implementations @@ -474,35 +463,35 @@ contract BountyManager is IBountyManager, Module, PaymentClient { } /// @inheritdoc IBountyManager - function grantClaimAdminRole(address addr) external onlyAuthorized { + function grantClaimAdminRole(address addr) external onlyProposalOwner { IRoleAuthorizer roleAuthorizer = IRoleAuthorizer(address(__Module_proposal.authorizer())); roleAuthorizer.grantRoleFromModule(uint8(Roles.ClaimAdmin), addr); } /// @inheritdoc IBountyManager - function grantVerifyAdminRole(address addr) external onlyAuthorized { + function grantVerifyAdminRole(address addr) external onlyProposalOwner { IRoleAuthorizer roleAuthorizer = IRoleAuthorizer(address(__Module_proposal.authorizer())); roleAuthorizer.grantRoleFromModule(uint8(Roles.VerifyAdmin), addr); } /// @inheritdoc IBountyManager - function revokeBountyAdminRole(address addr) external onlyAuthorized { + function revokeBountyAdminRole(address addr) external onlyProposalOwner { IRoleAuthorizer roleAuthorizer = IRoleAuthorizer(address(__Module_proposal.authorizer())); roleAuthorizer.revokeRoleFromModule(uint8(Roles.BountyAdmin), addr); } /// @inheritdoc IBountyManager - function revokeClaimAdminRole(address addr) external onlyAuthorized { + function revokeClaimAdminRole(address addr) external onlyProposalOwner { IRoleAuthorizer roleAuthorizer = IRoleAuthorizer(address(__Module_proposal.authorizer())); roleAuthorizer.revokeRoleFromModule(uint8(Roles.ClaimAdmin), addr); } /// @inheritdoc IBountyManager - function revokeVerifyAdminRole(address addr) external onlyAuthorized { + function revokeVerifyAdminRole(address addr) external onlyProposalOwner { IRoleAuthorizer roleAuthorizer = IRoleAuthorizer(address(__Module_proposal.authorizer())); roleAuthorizer.revokeRoleFromModule(uint8(Roles.VerifyAdmin), addr); diff --git a/src/modules/logicModule/IBountyManager.sol b/src/modules/logicModule/IBountyManager.sol index 5e04b0642..bef48793d 100644 --- a/src/modules/logicModule/IBountyManager.sol +++ b/src/modules/logicModule/IBountyManager.sol @@ -49,9 +49,6 @@ interface IBountyManager is IPaymentClient { //-------------------------------------------------------------------------- // Errors - /// @notice Access only to addresses with the given role id of BountyAdmin - error Module__BountyManager__OnlyRole(uint8 id, address module); - /// @notice Access only to addresses that are listed as contributors in the according claim error Module__BountyManager__OnlyClaimContributor(); diff --git a/src/modules/logicModule/MilestoneManager.sol b/src/modules/logicModule/MilestoneManager.sol index 5a0020386..9e66867a8 100644 --- a/src/modules/logicModule/MilestoneManager.sol +++ b/src/modules/logicModule/MilestoneManager.sol @@ -345,7 +345,7 @@ contract MilestoneManager is IMilestoneManager, Module, PaymentClient { uint budget, Contributor[] calldata contributors, bytes calldata details - ) external onlyAuthorizedOrManager returns (uint) { + ) external onlyProposalOwnerOrManager returns (uint) { _validateMilestoneDetails(duration, budget, contributors, details); return _addMilestone(duration, budget, contributors, details); @@ -354,7 +354,7 @@ contract MilestoneManager is IMilestoneManager, Module, PaymentClient { /// @inheritdoc IMilestoneManager function stopMilestone(uint prevId, uint id) external - onlyAuthorizedOrManager + onlyProposalOwnerOrManager validId(id) { Milestone storage m = _milestoneRegistry[id]; @@ -385,7 +385,7 @@ contract MilestoneManager is IMilestoneManager, Module, PaymentClient { /// @inheritdoc IMilestoneManager function removeMilestone(uint prevId, uint id) external - onlyAuthorizedOrManager + onlyProposalOwnerOrManager validId(id) { Milestone storage m = _milestoneRegistry[id]; @@ -406,7 +406,7 @@ contract MilestoneManager is IMilestoneManager, Module, PaymentClient { } /// @inheritdoc IMilestoneManager - function startNextMilestone() external onlyAuthorizedOrManager { + function startNextMilestone() external onlyProposalOwnerOrManager { if (!isNextMilestoneActivatable()) { revert Module__MilestoneManager__MilestoneNotActivateable(); } @@ -481,7 +481,7 @@ contract MilestoneManager is IMilestoneManager, Module, PaymentClient { uint budget, Contributor[] calldata contributors, bytes calldata details - ) external onlyAuthorizedOrManager validId(id) { + ) external onlyProposalOwnerOrManager validId(id) { _validateMilestoneDetails(duration, budget, contributors, details); Milestone storage m = _milestoneRegistry[id]; @@ -530,7 +530,7 @@ contract MilestoneManager is IMilestoneManager, Module, PaymentClient { /// @inheritdoc IMilestoneManager function moveMilestoneInList(uint id, uint prevId, uint idToPositionAfter) external - onlyAuthorizedOrManager + onlyProposalOwnerOrManager validMilestonePositionShift(id, idToPositionAfter) { _milestoneList.moveIdInList(id, prevId, idToPositionAfter); @@ -559,7 +559,7 @@ contract MilestoneManager is IMilestoneManager, Module, PaymentClient { /// @inheritdoc IMilestoneManager function completeMilestone(uint milestoneId) external - onlyAuthorizedOrManager + onlyProposalOwnerOrManager validId(milestoneId) { Milestone storage m = _milestoneRegistry[milestoneId]; @@ -578,7 +578,7 @@ contract MilestoneManager is IMilestoneManager, Module, PaymentClient { /// @inheritdoc IMilestoneManager function declineMilestone(uint milestoneId) external - onlyAuthorizedOrManager + onlyProposalOwnerOrManager validId(milestoneId) { Milestone storage m = _milestoneRegistry[milestoneId]; @@ -683,7 +683,7 @@ contract MilestoneManager is IMilestoneManager, Module, PaymentClient { function updateMilestoneUpdateTimelock(uint _newTimelock) external - onlyAuthorized + onlyProposalOwner { _milestoneUpdateTimelock = _newTimelock; emit MilestoneUpdateTimelockUpdated(_milestoneUpdateTimelock); diff --git a/src/modules/logicModule/RecurringPaymentManager.sol b/src/modules/logicModule/RecurringPaymentManager.sol index 33fa547d6..3545a881c 100644 --- a/src/modules/logicModule/RecurringPaymentManager.sol +++ b/src/modules/logicModule/RecurringPaymentManager.sol @@ -168,7 +168,7 @@ contract RecurringPaymentManager is address recipient ) external - onlyAuthorizedOrManager + onlyProposalOwnerOrManager validAmount(amount) validStartEpoch(startEpoch) validRecipient(recipient) @@ -202,7 +202,7 @@ contract RecurringPaymentManager is /// @inheritdoc IRecurringPaymentManager function removeRecurringPayment(uint prevId, uint id) external - onlyAuthorizedOrManager + onlyProposalOwnerOrManager { //trigger to resolve all due Payments _triggerFor(id, id); diff --git a/src/modules/paymentProcessor/StreamingPaymentProcessor.sol b/src/modules/paymentProcessor/StreamingPaymentProcessor.sol index 58c6bbd99..ca6b15ce9 100644 --- a/src/modules/paymentProcessor/StreamingPaymentProcessor.sol +++ b/src/modules/paymentProcessor/StreamingPaymentProcessor.sol @@ -208,7 +208,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { function removeAllContributorPayments( IPaymentClient client, address contributor - ) external onlyAuthorized { + ) external onlyProposalOwner { if ( _findAddressInActiveVestings(address(client), contributor) == type(uint).max @@ -226,7 +226,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { address contributor, uint walletId, bool retryForUnclaimableAmounts - ) external onlyAuthorized { + ) external onlyProposalOwner { // First, we give the vested funds from this specific walletId to the beneficiary _claimForSpecificWalletId( address(client), contributor, walletId, retryForUnclaimableAmounts diff --git a/src/proposal/Proposal.sol b/src/proposal/Proposal.sol index 8d178d393..9aae781c8 100644 --- a/src/proposal/Proposal.sol +++ b/src/proposal/Proposal.sol @@ -46,7 +46,7 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { /// @notice Modifier to guarantee function is only callable by authorized /// address. - modifier onlyAuthorized() { + modifier onlyProposalOwner() { if (!authorizer.isAuthorized(_msgSender())) { revert Proposal__CallerNotAuthorized(); } @@ -58,7 +58,7 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { /// @notice Modifier to guarantee function is only callable by authorized /// address or manager. - modifier onlyAuthorizedOrManager() { + modifier onlyProposalOwnerOrManager() { if (!authorizer.isAuthorized(_msgSender()) && _msgSender() != manager()) { revert Proposal__CallerNotAuthorized(); @@ -276,10 +276,10 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { } //-------------------------------------------------------------------------- - // onlyAuthorized Functions + // onlyProposalOwner Functions /// @inheritdoc IProposal - function setAuthorizer(IAuthorizer authorizer_) external onlyAuthorized { + function setAuthorizer(IAuthorizer authorizer_) external onlyProposalOwner { addModule(address(authorizer_)); removeModule(address(authorizer)); authorizer = authorizer_; @@ -289,7 +289,7 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { /// @inheritdoc IProposal function setFundingManager(IFundingManager fundingManager_) external - onlyAuthorized + onlyProposalOwner { addModule(address(fundingManager_)); removeModule(address(fundingManager)); @@ -300,7 +300,7 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { /// @inheritdoc IProposal function setPaymentProcessor(IPaymentProcessor paymentProcessor_) external - onlyAuthorized + onlyProposalOwner { addModule(address(paymentProcessor_)); removeModule(address(paymentProcessor)); @@ -311,7 +311,7 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { /// @inheritdoc IProposal function executeTx(address target, bytes memory data) external - onlyAuthorized + onlyProposalOwner returns (bytes memory) { bool ok; diff --git a/src/proposal/base/ModuleManager.sol b/src/proposal/base/ModuleManager.sol index 92db78dde..350fc8387 100644 --- a/src/proposal/base/ModuleManager.sol +++ b/src/proposal/base/ModuleManager.sol @@ -173,7 +173,7 @@ abstract contract ModuleManager is } //-------------------------------------------------------------------------- - // onlyAuthorized Functions + // onlyProposalOwner Functions /// @inheritdoc IModuleManager function addModule(address module) diff --git a/test/e2e/BountyManagerLifecycle.t.sol b/test/e2e/BountyManagerLifecycle.t.sol index 118f914e3..5213921bd 100644 --- a/test/e2e/BountyManagerLifecycle.t.sol +++ b/test/e2e/BountyManagerLifecycle.t.sol @@ -145,6 +145,5 @@ contract BountyManagerLifecycle is E2eTest { assertEq(token.balanceOf(contrib1.addr), 150e18); assertEq(token.balanceOf(contrib2.addr), 150e18); - // TODO: Update with real roleAuthorizer } } diff --git a/test/e2e/CreateNewProposal.t.sol b/test/e2e/CreateNewProposal.t.sol index 7f3427dd8..1d1ae37c0 100644 --- a/test/e2e/CreateNewProposal.t.sol +++ b/test/e2e/CreateNewProposal.t.sol @@ -229,7 +229,7 @@ contract ProposalCreation is Test { // This function creates a new Proposal // For this we create a few config files, that we'll later use in the Proposalfactory: // -proposalFactoryConfig: Contains the owner and paymentToken address - // -authorizerFactoryConfig: Contains initially Authorized Addresses, that can use onlyAuthorized functions in the proposal + // -authorizerFactoryConfig: Contains initially Authorized Addresses, that can use onlyProposalOwner functions in the proposal // Notice that we have to decrypt the initialAuthorizedAddresses into a bytes format for correct // creation of the module in the ModuleFactory // -paymentProcessorFactoryConfig: Just signals the Factory, that we want to integrate the SimplePaymentProcessor here diff --git a/test/modules/logicModule/BountyManager.t.sol b/test/modules/logicModule/BountyManager.t.sol index 00580c540..8736d25d2 100644 --- a/test/modules/logicModule/BountyManager.t.sol +++ b/test/modules/logicModule/BountyManager.t.sol @@ -99,9 +99,9 @@ contract BountyManagerTest is ModuleTest { //onlyBountyAdmin vm.expectRevert( abi.encodeWithSelector( - IBountyManager.Module__BountyManager__OnlyRole.selector, - IBountyManager.Roles.BountyAdmin, - address(bountyManager) + IModule.Module__CallerNotAuthorized.selector//, + //IBountyManager.Roles.BountyAdmin, + //address(bountyManager) ) ); } @@ -395,9 +395,9 @@ contract BountyManagerTest is ModuleTest { //onlyBountyAdmin vm.expectRevert( abi.encodeWithSelector( - IBountyManager.Module__BountyManager__OnlyRole.selector, + IModule.Module__CallerNotAuthorized.selector/*, IBountyManager.Roles.BountyAdmin, - address(bountyManager) + address(bountyManager)*/ ) ); bountyManager.addBounty(0, 0, bytes("")); @@ -476,9 +476,9 @@ contract BountyManagerTest is ModuleTest { //onlyClaimAdmin vm.expectRevert( abi.encodeWithSelector( - IBountyManager.Module__BountyManager__OnlyRole.selector, + IModule.Module__CallerNotAuthorized.selector/*, IBountyManager.Roles.ClaimAdmin, - address(bountyManager) + address(bountyManager)*/ ) ); bountyManager.addClaim(0, DEFAULT_CONTRIBUTORS, bytes("")); @@ -513,9 +513,9 @@ contract BountyManagerTest is ModuleTest { //onlyBountyAdmin vm.expectRevert( abi.encodeWithSelector( - IBountyManager.Module__BountyManager__OnlyRole.selector, + IModule.Module__CallerNotAuthorized.selector/*, IBountyManager.Roles.BountyAdmin, - address(bountyManager) + address(bountyManager)*/ ) ); bountyManager.updateBounty(0, bytes("")); @@ -559,9 +559,9 @@ contract BountyManagerTest is ModuleTest { //onlyBountyAdmin vm.expectRevert( abi.encodeWithSelector( - IBountyManager.Module__BountyManager__OnlyRole.selector, + IModule.Module__CallerNotAuthorized.selector/*, IBountyManager.Roles.BountyAdmin, - address(bountyManager) + address(bountyManager)*/ ) ); bountyManager.lockBounty(0); @@ -789,9 +789,9 @@ contract BountyManagerTest is ModuleTest { //onlyVerifyAdmin vm.expectRevert( abi.encodeWithSelector( - IBountyManager.Module__BountyManager__OnlyRole.selector, - IBountyManager.Roles.VerifyAdmin, - address(bountyManager) + IModule.Module__CallerNotAuthorized.selector/*, + IBountyManager.Roles.BountyAdmin, + address(bountyManager)*/ ) ); bountyManager.verifyClaim(0, 1); diff --git a/test/modules/logicModule/RecurringPaymentManager.t.sol b/test/modules/logicModule/RecurringPaymentManager.t.sol index 0ba51ba9c..2a90d91e6 100644 --- a/test/modules/logicModule/RecurringPaymentManager.t.sol +++ b/test/modules/logicModule/RecurringPaymentManager.t.sol @@ -251,7 +251,7 @@ contract RecurringPaymentManagerTest is ModuleTest { //Warp to a reasonable time vm.warp(2 weeks); - //onlyAuthorizedOrManager + //onlyProposalOwnerOrManager vm.prank(address(0xBEEF)); //Not Authorized vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); @@ -350,7 +350,7 @@ contract RecurringPaymentManagerTest is ModuleTest { //Init Module recurringPaymentManager.init(_proposal, _METADATA, abi.encode(1 weeks)); - //onlyAuthorizedOrManager + //onlyProposalOwnerOrManager vm.prank(address(0xBEEF)); //Not Authorized vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); diff --git a/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol b/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol index 3c42eff75..1254d79ed 100644 --- a/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol +++ b/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol @@ -639,7 +639,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { assertTrue(expectedSalary != 0); - vm.prank(address(this)); // stupid line, ik, but it's just here to show that onlyAuthorized can call the next function + vm.prank(address(this)); // stupid line, ik, but it's just here to show that onlyProposalOwner can call the next function paymentProcessor.removePaymentForSpecificWalletId( paymentClient, contributor1, walletId, false ); @@ -756,7 +756,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { assertTrue(salary2 != 0); - vm.prank(address(this)); // stupid line, ik, but it's just here to show that onlyAuthorized can call the next function + vm.prank(address(this)); // stupid line, ik, but it's just here to show that onlyProposalOwner can call the next function paymentProcessor.removePaymentForSpecificWalletId( paymentClient, contributor1, From c1f41c229c5672e1577d7ddbc0f4cfc3a33cd79a Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Fri, 28 Jul 2023 16:01:37 +0200 Subject: [PATCH 02/32] move roles to module --- src/modules/authorizer/IRoleAuthorizer.sol | 4 ++ src/modules/authorizer/RoleAuthorizer.sol | 12 ++++- src/modules/base/IModule.sol | 4 ++ src/modules/base/Module.sol | 38 +++++++++++++-- src/modules/logicModule/BountyManager.sol | 46 ------------------- src/modules/logicModule/IBountyManager.sol | 4 +- src/proposal/Proposal.sol | 5 +- test/e2e/BountyManagerLifecycle.t.sol | 13 ++++-- test/modules/authorizer/RoleAuthorizer.t.sol | 42 ++++++++--------- .../authorizer/TokenGatedRoleAuthorizer.t.sol | 12 ++--- test/modules/logicModule/BountyManager.t.sol | 37 ++++++++------- test/utils/mocks/modules/AuthorizerMock.sol | 14 +++++- 12 files changed, 124 insertions(+), 107 deletions(-) diff --git a/src/modules/authorizer/IRoleAuthorizer.sol b/src/modules/authorizer/IRoleAuthorizer.sol index 4f6229ad5..77e8c7b77 100644 --- a/src/modules/authorizer/IRoleAuthorizer.sol +++ b/src/modules/authorizer/IRoleAuthorizer.sol @@ -75,4 +75,8 @@ interface IRoleAuthorizer is /// @param role The role to remove admin access from /// @dev The module itself can still grant and revoke it's own roles. This only burns third-party access to the role. function burnAdminRole(uint8 role) external; + + function getOwnerRole() external returns(bytes32); + + function getManagerRole() external returns(bytes32); } diff --git a/src/modules/authorizer/RoleAuthorizer.sol b/src/modules/authorizer/RoleAuthorizer.sol index 21ab77884..a4b1686c7 100644 --- a/src/modules/authorizer/RoleAuthorizer.sol +++ b/src/modules/authorizer/RoleAuthorizer.sol @@ -29,8 +29,8 @@ contract RoleAuthorizer is mapping(address => bool) public selfManagedModules; // Stored for easy public reference. Other Modules can assume the following roles to exist - bytes32 public PROPOSAL_OWNER_ROLE; - bytes32 public PROPOSAL_MANAGER_ROLE; + bytes32 internal PROPOSAL_OWNER_ROLE; + bytes32 internal PROPOSAL_MANAGER_ROLE; bytes32 public constant BURN_ADMIN_ROLE = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; @@ -229,4 +229,12 @@ contract RoleAuthorizer is bytes32 roleId = generateRoleId(_msgSender(), role); _setRoleAdmin(roleId, BURN_ADMIN_ROLE); } + + function getOwnerRole() public returns(bytes32) { + return PROPOSAL_OWNER_ROLE; + } + + function getManagerRole() public returns(bytes32) { + return PROPOSAL_MANAGER_ROLE; + } } diff --git a/src/modules/base/IModule.sol b/src/modules/base/IModule.sol index 39b19b96c..a128eed01 100644 --- a/src/modules/base/IModule.sol +++ b/src/modules/base/IModule.sol @@ -82,4 +82,8 @@ interface IModule { /// @notice Returns the module's {IProposal} proposal instance. /// @return The module's proposal. function proposal() external view returns (IProposal); + + function grantModuleRole(uint8 role, address addr) external; + + function revokeModuleRole(uint8 role, address addr) external; } diff --git a/src/modules/base/Module.sol b/src/modules/base/Module.sol index e2516aa1b..97762b4f7 100644 --- a/src/modules/base/Module.sol +++ b/src/modules/base/Module.sol @@ -62,8 +62,11 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { /// @notice Modifier to guarantee function is only callable by addresses /// authorized via Proposal. modifier onlyProposalOwner() { - IAuthorizer authorizer = __Module_proposal.authorizer(); - if (!authorizer.isAuthorized(_msgSender())) { + IRoleAuthorizer authorizer = IRoleAuthorizer(address(__Module_proposal.authorizer())); + + bytes32 ownerRole = authorizer.getOwnerRole(); + + if ( !authorizer.hasRole(ownerRole, _msgSender())) { revert Module__CallerNotAuthorized(); } _; @@ -72,10 +75,14 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { /// @notice Modifier to guarantee function is only callable by either /// addresses authorized via Proposal or the Proposal's manager. modifier onlyProposalOwnerOrManager() { - IAuthorizer authorizer = __Module_proposal.authorizer(); + IRoleAuthorizer authorizer = IRoleAuthorizer(address(__Module_proposal.authorizer())); + + bytes32 ownerRole = authorizer.getOwnerRole(); + bytes32 managerRole = authorizer.getManagerRole(); + if ( - !authorizer.isAuthorized(_msgSender()) - && __Module_proposal.manager() != _msgSender() + !authorizer.hasRole(ownerRole, _msgSender()) + && !authorizer.hasRole(managerRole, _msgSender()) ) { revert Module__CallerNotAuthorized(); } @@ -192,6 +199,27 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { return __Module_proposal; } + //-------------------------------------------------------------------------- + // Role Management + + function grantModuleRole(uint8 role, address addr) + external + onlyProposalOwner + { + IRoleAuthorizer roleAuthorizer = + IRoleAuthorizer(address(__Module_proposal.authorizer())); + roleAuthorizer.grantRoleFromModule(uint8(role), addr); + } + + function revokeModuleRole(uint8 role, address addr) + external + onlyProposalOwner + { + IRoleAuthorizer roleAuthorizer = + IRoleAuthorizer(address(__Module_proposal.authorizer())); + roleAuthorizer.revokeRoleFromModule(uint8(role), addr); + } + //-------------------------------------------------------------------------- // Internal Functions diff --git a/src/modules/logicModule/BountyManager.sol b/src/modules/logicModule/BountyManager.sol index f05ef1c53..647de8bf2 100644 --- a/src/modules/logicModule/BountyManager.sol +++ b/src/modules/logicModule/BountyManager.sol @@ -451,52 +451,6 @@ contract BountyManager is IBountyManager, Module, PaymentClient { emit ClaimVerified(claimId, bountyId); } - //---------------------------------- - // Role Functions - - /// @inheritdoc IBountyManager - function grantBountyAdminRole(address addr) external onlyProposalOwner { - //@todo Will be removed in the future and moved to the authorizer directly - IRoleAuthorizer roleAuthorizer = - IRoleAuthorizer(address(__Module_proposal.authorizer())); //@todo Cast to IRoleAuthorizer wont be necessary as soon as the IAuthorizer Interface in Proposal is replaced by IRoleAuthorizer, this is the same for the other implementations - roleAuthorizer.grantRoleFromModule(uint8(Roles.BountyAdmin), addr); - } - - /// @inheritdoc IBountyManager - function grantClaimAdminRole(address addr) external onlyProposalOwner { - IRoleAuthorizer roleAuthorizer = - IRoleAuthorizer(address(__Module_proposal.authorizer())); - roleAuthorizer.grantRoleFromModule(uint8(Roles.ClaimAdmin), addr); - } - - /// @inheritdoc IBountyManager - function grantVerifyAdminRole(address addr) external onlyProposalOwner { - IRoleAuthorizer roleAuthorizer = - IRoleAuthorizer(address(__Module_proposal.authorizer())); - roleAuthorizer.grantRoleFromModule(uint8(Roles.VerifyAdmin), addr); - } - - /// @inheritdoc IBountyManager - function revokeBountyAdminRole(address addr) external onlyProposalOwner { - IRoleAuthorizer roleAuthorizer = - IRoleAuthorizer(address(__Module_proposal.authorizer())); - roleAuthorizer.revokeRoleFromModule(uint8(Roles.BountyAdmin), addr); - } - - /// @inheritdoc IBountyManager - function revokeClaimAdminRole(address addr) external onlyProposalOwner { - IRoleAuthorizer roleAuthorizer = - IRoleAuthorizer(address(__Module_proposal.authorizer())); - roleAuthorizer.revokeRoleFromModule(uint8(Roles.ClaimAdmin), addr); - } - - /// @inheritdoc IBountyManager - function revokeVerifyAdminRole(address addr) external onlyProposalOwner { - IRoleAuthorizer roleAuthorizer = - IRoleAuthorizer(address(__Module_proposal.authorizer())); - roleAuthorizer.revokeRoleFromModule(uint8(Roles.VerifyAdmin), addr); - } - //-------------------------------------------------------------------------- // {PaymentClient} Function Implementations diff --git a/src/modules/logicModule/IBountyManager.sol b/src/modules/logicModule/IBountyManager.sol index bef48793d..6e5ddd067 100644 --- a/src/modules/logicModule/IBountyManager.sol +++ b/src/modules/logicModule/IBountyManager.sol @@ -230,7 +230,7 @@ interface IBountyManager is IPaymentClient { //---------------------------------- // Role Functions - + /* /// @notice Grants the BountyAdmin Role to a specified address /// @dev Only callable by authorized addresses. /// @param addr Address that gets the role granted @@ -260,4 +260,6 @@ interface IBountyManager is IPaymentClient { /// @dev Only callable by authorized addresses. /// @param addr Address that gets their role revoked function revokeVerifyAdminRole(address addr) external; + + */ } diff --git a/src/proposal/Proposal.sol b/src/proposal/Proposal.sol index 9aae781c8..069b4e280 100644 --- a/src/proposal/Proposal.sol +++ b/src/proposal/Proposal.sol @@ -279,7 +279,10 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { // onlyProposalOwner Functions /// @inheritdoc IProposal - function setAuthorizer(IAuthorizer authorizer_) external onlyProposalOwner { + function setAuthorizer(IAuthorizer authorizer_) + external + onlyProposalOwner + { addModule(address(authorizer_)); removeModule(address(authorizer)); authorizer = authorizer_; diff --git a/test/e2e/BountyManagerLifecycle.t.sol b/test/e2e/BountyManagerLifecycle.t.sol index 5213921bd..c13cf3f97 100644 --- a/test/e2e/BountyManagerLifecycle.t.sol +++ b/test/e2e/BountyManagerLifecycle.t.sol @@ -77,7 +77,9 @@ contract BountyManagerLifecycle is E2eTest { } // we authorize the deployer of the proposal as the bounty admin - bountyManager.grantBountyAdminRole(address(this)); + bountyManager.grantModuleRole( + uint8(IBountyManager.Roles.BountyAdmin), address(this) + ); // Funders deposit funds // IMPORTANT @@ -119,7 +121,9 @@ contract BountyManagerLifecycle is E2eTest { IBountyManager.Contributor(address(0xb0b), 150e18); //auth.setIsAuthorized(address(0xA11CE), true); - bountyManager.grantClaimAdminRole(address(0xA11CE)); + bountyManager.grantModuleRole( + uint8(IBountyManager.Roles.ClaimAdmin), address(0xA11CE) + ); IBountyManager.Contributor[] memory contribs = new IBountyManager.Contributor[](2); @@ -136,7 +140,9 @@ contract BountyManagerLifecycle is E2eTest { address verifier1 = makeAddr("verifier 1"); //auth.setIsAuthorized(verifier1, true); - bountyManager.grantVerifyAdminRole(verifier1); + bountyManager.grantModuleRole( + uint8(IBountyManager.Roles.VerifyAdmin), verifier1 + ); vm.prank(verifier1); bountyManager.verifyClaim(claimId, bountyId); @@ -144,6 +150,5 @@ contract BountyManagerLifecycle is E2eTest { // Bounty has been paid out assertEq(token.balanceOf(contrib1.addr), 150e18); assertEq(token.balanceOf(contrib2.addr), 150e18); - } } diff --git a/test/modules/authorizer/RoleAuthorizer.t.sol b/test/modules/authorizer/RoleAuthorizer.t.sol index 1f65bd55f..743e8a1ce 100644 --- a/test/modules/authorizer/RoleAuthorizer.t.sol +++ b/test/modules/authorizer/RoleAuthorizer.t.sol @@ -79,16 +79,16 @@ contract RoleAuthorizerTest is Test { ); assertEq( _authorizer.hasRole( - _authorizer.PROPOSAL_MANAGER_ROLE(), address(this) + _authorizer.getManagerRole(), address(this) ), true ); assertEq( - _authorizer.hasRole(_authorizer.PROPOSAL_OWNER_ROLE(), ALBA), true + _authorizer.hasRole(_authorizer.getOwnerRole(), ALBA), true ); assertEq( _authorizer.hasRole( - _authorizer.PROPOSAL_OWNER_ROLE(), address(this) + _authorizer.getOwnerRole(), address(this) ), false ); @@ -119,7 +119,7 @@ contract RoleAuthorizerTest is Test { assertEq(testAuthorizer.isAuthorized(0, address(this)), false); assertEq( testAuthorizer.getRoleMemberCount( - testAuthorizer.PROPOSAL_OWNER_ROLE() + testAuthorizer.getOwnerRole() ), 1 ); @@ -145,7 +145,7 @@ contract RoleAuthorizerTest is Test { assertEq(testAuthorizer.isAuthorized(0, address(this)), true); assertEq( testAuthorizer.getRoleMemberCount( - testAuthorizer.PROPOSAL_OWNER_ROLE() + testAuthorizer.getOwnerRole() ), 1 ); @@ -168,7 +168,7 @@ contract RoleAuthorizerTest is Test { assertEq(address(_authorizer.proposal()), address(_proposal)); assertEq(_authorizer.isAuthorized(0, ALBA), true); assertEq( - _authorizer.getRoleMemberCount(_authorizer.PROPOSAL_OWNER_ROLE()), 1 + _authorizer.getRoleMemberCount(_authorizer.getOwnerRole()), 1 ); } @@ -206,14 +206,14 @@ contract RoleAuthorizerTest is Test { function testGrantOwnerRole(address[] memory newAuthorized) public { uint amountAuth = - _authorizer.getRoleMemberCount(_authorizer.PROPOSAL_OWNER_ROLE()); + _authorizer.getRoleMemberCount(_authorizer.getOwnerRole()); _validateAuthorizedList(newAuthorized); vm.startPrank(address(ALBA)); for (uint i; i < newAuthorized.length; ++i) { _authorizer.grantRole( - _authorizer.PROPOSAL_OWNER_ROLE(), newAuthorized[i] + _authorizer.getOwnerRole(), newAuthorized[i] ); } vm.stopPrank(); @@ -221,13 +221,13 @@ contract RoleAuthorizerTest is Test { for (uint i; i < newAuthorized.length; ++i) { assertEq( _authorizer.hasRole( - _authorizer.PROPOSAL_OWNER_ROLE(), newAuthorized[i] + _authorizer.getOwnerRole(), newAuthorized[i] ), true ); } assertEq( - _authorizer.getRoleMemberCount(_authorizer.PROPOSAL_OWNER_ROLE()), + _authorizer.getRoleMemberCount(_authorizer.getOwnerRole()), (amountAuth + newAuthorized.length) ); } @@ -235,32 +235,32 @@ contract RoleAuthorizerTest is Test { function testRevokeOwnerRole() public { //Add Bob as owner vm.startPrank(address(ALBA)); - _authorizer.grantRole(_authorizer.PROPOSAL_OWNER_ROLE(), BOB); //Meet your new Manager + _authorizer.grantRole(_authorizer.getOwnerRole(), BOB); //Meet your new Manager vm.stopPrank(); assertEq( - _authorizer.hasRole(_authorizer.PROPOSAL_OWNER_ROLE(), BOB), true + _authorizer.hasRole(_authorizer.getOwnerRole(), BOB), true ); uint amountAuth = - _authorizer.getRoleMemberCount(_authorizer.PROPOSAL_OWNER_ROLE()); + _authorizer.getRoleMemberCount(_authorizer.getOwnerRole()); vm.startPrank(address(ALBA)); - _authorizer.revokeRole(_authorizer.PROPOSAL_OWNER_ROLE(), ALBA); + _authorizer.revokeRole(_authorizer.getOwnerRole(), ALBA); vm.stopPrank(); assertEq( - _authorizer.hasRole(_authorizer.PROPOSAL_OWNER_ROLE(), ALBA), false + _authorizer.hasRole(_authorizer.getOwnerRole(), ALBA), false ); assertEq( - _authorizer.getRoleMemberCount(_authorizer.PROPOSAL_OWNER_ROLE()), + _authorizer.getRoleMemberCount(_authorizer.getOwnerRole()), amountAuth - 1 ); } function testRemoveLastOwnerFails() public { uint amountAuth = - _authorizer.getRoleMemberCount(_authorizer.PROPOSAL_OWNER_ROLE()); - bytes32 ownerRole = _authorizer.PROPOSAL_OWNER_ROLE(); //To correctly time the vm.expectRevert + _authorizer.getRoleMemberCount(_authorizer.getOwnerRole()); + bytes32 ownerRole = _authorizer.getOwnerRole(); //To correctly time the vm.expectRevert vm.expectRevert( abi.encodeWithSelector( @@ -274,7 +274,7 @@ contract RoleAuthorizerTest is Test { assertEq(_authorizer.isAuthorized(ALBA), true); assertEq( - _authorizer.getRoleMemberCount(_authorizer.PROPOSAL_OWNER_ROLE()), + _authorizer.getRoleMemberCount(_authorizer.getOwnerRole()), amountAuth ); } @@ -672,7 +672,7 @@ contract RoleAuthorizerTest is Test { // Now we set the OWNER as Role admin vm.startPrank(BOB); - _authorizer.transferAdminRole(roleId, _authorizer.PROPOSAL_OWNER_ROLE()); + _authorizer.transferAdminRole(roleId, _authorizer.getOwnerRole()); vm.stopPrank(); // ALBA can now freely grant and revoke roles @@ -690,7 +690,7 @@ contract RoleAuthorizerTest is Test { bytes32 roleId = _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_0)); - bytes32 ownerRole = _authorizer.PROPOSAL_OWNER_ROLE(); //Buffer this to time revert + bytes32 ownerRole = _authorizer.getOwnerRole(); //Buffer this to time revert // BOB is not allowed to do this vm.startPrank(BOB); diff --git a/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol b/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol index 3698df0a3..f6007f979 100644 --- a/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol +++ b/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol @@ -65,16 +65,16 @@ contract TokenGatedRoleAuthorizerUpstreamTests is RoleAuthorizerTest { ); assertEq( _authorizer.hasRole( - _authorizer.PROPOSAL_MANAGER_ROLE(), address(this) + _authorizer.getManagerRole(), address(this) ), true ); assertEq( - _authorizer.hasRole(_authorizer.PROPOSAL_OWNER_ROLE(), ALBA), true + _authorizer.hasRole(_authorizer.getOwnerRole(), ALBA), true ); assertEq( _authorizer.hasRole( - _authorizer.PROPOSAL_OWNER_ROLE(), address(this) + _authorizer.getOwnerRole(), address(this) ), false ); @@ -146,16 +146,16 @@ contract TokenGatedRoleAuthorizerTest is Test { ); assertEq( _authorizer.hasRole( - _authorizer.PROPOSAL_MANAGER_ROLE(), address(this) + _authorizer.getManagerRole(), address(this) ), true ); assertEq( - _authorizer.hasRole(_authorizer.PROPOSAL_OWNER_ROLE(), ALBA), true + _authorizer.hasRole(_authorizer.getOwnerRole(), ALBA), true ); assertEq( _authorizer.hasRole( - _authorizer.PROPOSAL_OWNER_ROLE(), address(this) + _authorizer.getOwnerRole(), address(this) ), false ); diff --git a/test/modules/logicModule/BountyManager.t.sol b/test/modules/logicModule/BountyManager.t.sol index 8736d25d2..92148b07a 100644 --- a/test/modules/logicModule/BountyManager.t.sol +++ b/test/modules/logicModule/BountyManager.t.sol @@ -99,9 +99,9 @@ contract BountyManagerTest is ModuleTest { //onlyBountyAdmin vm.expectRevert( abi.encodeWithSelector( - IModule.Module__CallerNotAuthorized.selector//, - //IBountyManager.Roles.BountyAdmin, - //address(bountyManager) + IModule.Module__CallerNotAuthorized.selector //, + //IBountyManager.Roles.BountyAdmin, + //address(bountyManager) ) ); } @@ -395,7 +395,7 @@ contract BountyManagerTest is ModuleTest { //onlyBountyAdmin vm.expectRevert( abi.encodeWithSelector( - IModule.Module__CallerNotAuthorized.selector/*, + IModule.Module__CallerNotAuthorized.selector /*, IBountyManager.Roles.BountyAdmin, address(bountyManager)*/ ) @@ -476,7 +476,7 @@ contract BountyManagerTest is ModuleTest { //onlyClaimAdmin vm.expectRevert( abi.encodeWithSelector( - IModule.Module__CallerNotAuthorized.selector/*, + IModule.Module__CallerNotAuthorized.selector /*, IBountyManager.Roles.ClaimAdmin, address(bountyManager)*/ ) @@ -513,7 +513,7 @@ contract BountyManagerTest is ModuleTest { //onlyBountyAdmin vm.expectRevert( abi.encodeWithSelector( - IModule.Module__CallerNotAuthorized.selector/*, + IModule.Module__CallerNotAuthorized.selector /*, IBountyManager.Roles.BountyAdmin, address(bountyManager)*/ ) @@ -559,7 +559,7 @@ contract BountyManagerTest is ModuleTest { //onlyBountyAdmin vm.expectRevert( abi.encodeWithSelector( - IModule.Module__CallerNotAuthorized.selector/*, + IModule.Module__CallerNotAuthorized.selector /*, IBountyManager.Roles.BountyAdmin, address(bountyManager)*/ ) @@ -789,7 +789,7 @@ contract BountyManagerTest is ModuleTest { //onlyVerifyAdmin vm.expectRevert( abi.encodeWithSelector( - IModule.Module__CallerNotAuthorized.selector/*, + IModule.Module__CallerNotAuthorized.selector /*, IBountyManager.Roles.BountyAdmin, address(bountyManager)*/ ) @@ -801,24 +801,23 @@ contract BountyManagerTest is ModuleTest { // Role Functions //@todo trivial to be removed as soon as the functionality is moved to RoleAuthorizer - function testGrantBountyAdminRole(address addr) public { - bountyManager.grantBountyAdminRole(addr); + function testGrantBountyAdminRole(uint8 role, address addr) public { + vm.assume(role <= uint8(type(IBountyManager.Roles).max)); + bountyManager.grantModuleRole(role, addr); vm.prank(address(bountyManager)); - bool isAuthorized = _authorizer.isAuthorized( - uint8(IBountyManager.Roles.BountyAdmin), addr - ); + bool isAuthorized = _authorizer.isAuthorized(role, addr); assertTrue(isAuthorized); } - function testRevokeBountyAdminRole(address addr) public { - bountyManager.grantBountyAdminRole(addr); - bountyManager.revokeBountyAdminRole(addr); + function testRevokeBountyAdminRole(uint8 role, address addr) public { + vm.assume(role <= uint8(type(IBountyManager.Roles).max)); + + bountyManager.grantModuleRole(role, addr); + bountyManager.revokeModuleRole(role, addr); vm.prank(address(bountyManager)); - bool isAuthorized = _authorizer.isAuthorized( - uint8(IBountyManager.Roles.BountyAdmin), addr - ); + bool isAuthorized = _authorizer.isAuthorized(role, addr); assertFalse(isAuthorized); } diff --git a/test/utils/mocks/modules/AuthorizerMock.sol b/test/utils/mocks/modules/AuthorizerMock.sol index a0342af9a..7b006b1af 100644 --- a/test/utils/mocks/modules/AuthorizerMock.sol +++ b/test/utils/mocks/modules/AuthorizerMock.sol @@ -102,11 +102,21 @@ contract AuthorizerMock is IRoleAuthorizer, Module { function grantRole(bytes32, address) external {} - function hasRole(bytes32, address) external pure returns (bool) { - return false; + function hasRole(bytes32 role, address who) external view returns (bool) { + return _authorized[who] + || _roleAuthorized[role][who] + || _allAuthorized; } function revokeRole(bytes32, address) external pure {} function renounceRole(bytes32, address) external pure {} + + function getOwnerRole() external pure returns(bytes32) { + return 0; + } + + function getManagerRole() external pure returns(bytes32){ + return 0; + } } From d1e53c827b804663b2598873b13bbc9fc115472f Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Fri, 28 Jul 2023 18:12:30 +0200 Subject: [PATCH 03/32] remove moduleManagerRoles --- src/modules/authorizer/IRoleAuthorizer.sol | 4 +- src/modules/authorizer/RoleAuthorizer.sol | 4 +- src/modules/base/Module.sol | 10 +- src/proposal/base/IModuleManager.sol | 51 ------- src/proposal/base/ModuleManager.sol | 36 ----- test/modules/authorizer/RoleAuthorizer.t.sol | 38 ++--- .../authorizer/TokenGatedRoleAuthorizer.t.sol | 24 +-- test/proposal/base/ModuleManager.t.sol | 144 +----------------- test/utils/mocks/modules/AuthorizerMock.sol | 23 ++- 9 files changed, 42 insertions(+), 292 deletions(-) diff --git a/src/modules/authorizer/IRoleAuthorizer.sol b/src/modules/authorizer/IRoleAuthorizer.sol index 77e8c7b77..4bc0ab030 100644 --- a/src/modules/authorizer/IRoleAuthorizer.sol +++ b/src/modules/authorizer/IRoleAuthorizer.sol @@ -76,7 +76,7 @@ interface IRoleAuthorizer is /// @dev The module itself can still grant and revoke it's own roles. This only burns third-party access to the role. function burnAdminRole(uint8 role) external; - function getOwnerRole() external returns(bytes32); + function getOwnerRole() external returns (bytes32); - function getManagerRole() external returns(bytes32); + function getManagerRole() external returns (bytes32); } diff --git a/src/modules/authorizer/RoleAuthorizer.sol b/src/modules/authorizer/RoleAuthorizer.sol index a4b1686c7..9c292b3de 100644 --- a/src/modules/authorizer/RoleAuthorizer.sol +++ b/src/modules/authorizer/RoleAuthorizer.sol @@ -230,11 +230,11 @@ contract RoleAuthorizer is _setRoleAdmin(roleId, BURN_ADMIN_ROLE); } - function getOwnerRole() public returns(bytes32) { + function getOwnerRole() public returns (bytes32) { return PROPOSAL_OWNER_ROLE; } - function getManagerRole() public returns(bytes32) { + function getManagerRole() public returns (bytes32) { return PROPOSAL_MANAGER_ROLE; } } diff --git a/src/modules/base/Module.sol b/src/modules/base/Module.sol index 97762b4f7..768abe128 100644 --- a/src/modules/base/Module.sol +++ b/src/modules/base/Module.sol @@ -62,11 +62,12 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { /// @notice Modifier to guarantee function is only callable by addresses /// authorized via Proposal. modifier onlyProposalOwner() { - IRoleAuthorizer authorizer = IRoleAuthorizer(address(__Module_proposal.authorizer())); + IRoleAuthorizer authorizer = + IRoleAuthorizer(address(__Module_proposal.authorizer())); bytes32 ownerRole = authorizer.getOwnerRole(); - if ( !authorizer.hasRole(ownerRole, _msgSender())) { + if (!authorizer.hasRole(ownerRole, _msgSender())) { revert Module__CallerNotAuthorized(); } _; @@ -75,11 +76,12 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { /// @notice Modifier to guarantee function is only callable by either /// addresses authorized via Proposal or the Proposal's manager. modifier onlyProposalOwnerOrManager() { - IRoleAuthorizer authorizer = IRoleAuthorizer(address(__Module_proposal.authorizer())); + IRoleAuthorizer authorizer = + IRoleAuthorizer(address(__Module_proposal.authorizer())); bytes32 ownerRole = authorizer.getOwnerRole(); bytes32 managerRole = authorizer.getManagerRole(); - + if ( !authorizer.hasRole(ownerRole, _msgSender()) && !authorizer.hasRole(managerRole, _msgSender()) diff --git a/src/proposal/base/IModuleManager.sol b/src/proposal/base/IModuleManager.sol index 68c23c9d5..fa8da38e5 100644 --- a/src/proposal/base/IModuleManager.sol +++ b/src/proposal/base/IModuleManager.sol @@ -37,24 +37,6 @@ interface IModuleManager { /// @param module The module's address. event ModuleRemoved(address indexed module); - /// @notice Event emitted when account `account` is granted role `role` for - /// module `module`. - /// @param module The module's address. - /// @param role The access control role. - /// @param account The account the role was granted to. - event ModuleRoleGranted( - address indexed module, bytes32 indexed role, address indexed account - ); - - /// @notice Event emitted when account `account` is revoked role `role` for - /// module `module`. - /// @param module The module's address. - /// @param role The access control role. - /// @param account The account the role was revoked for. - event ModuleRoleRevoked( - address indexed module, bytes32 indexed role, address indexed account - ); - //-------------------------------------------------------------------------- // Functions @@ -91,37 +73,4 @@ interface IModuleManager { /// @notice Returns the number of modules. function modulesSize() external view returns (uint8); - - /// @notice Grants role `role` to account `account` in caller's access - /// control context. - /// @dev Only callable by enabled module. - /// @param role The access control role. - /// @param account The account to grant given role. - function grantRole(bytes32 role, address account) external; - - /// @notice Revokes role `role` from account `account` in caller's access - /// control context. - /// @dev Only callable by enabled module. - /// @param role The access control role. - /// @param account The account to revoke role for. - function revokeRole(bytes32 role, address account) external; - - /// @notice Renounces the caller's role `role` in module's `module` access - /// control context. - /// @param module The module in which's access control context the role - /// should be renounced. - /// @param role The access control role. - function renounceRole(address module, bytes32 role) external; - - /// @notice Returns whether the account `account` holds the role `role` in - /// the module's `module` access control context. - /// @param module The module in which's access control context the role - /// is checked. - /// @param role The access control role. - /// @param account The account to check role for. - /// @return True if account has role in module's access control context, - /// false otherwise. - function hasRole(address module, bytes32 role, address account) - external - returns (bool); } diff --git a/src/proposal/base/ModuleManager.sol b/src/proposal/base/ModuleManager.sol index 350fc8387..3bcde683e 100644 --- a/src/proposal/base/ModuleManager.sol +++ b/src/proposal/base/ModuleManager.sol @@ -143,15 +143,6 @@ abstract contract ModuleManager is //-------------------------------------------------------------------------- // Public View Functions - /// @inheritdoc IModuleManager - function hasRole(address module, bytes32 role, address account) - public - view - returns (bool) - { - return isModule(module) && _moduleRoles[module][role][account]; - } - /// @inheritdoc IModuleManager function isModule(address module) public @@ -213,33 +204,6 @@ abstract contract ModuleManager is return (ok, returnData); } - /// @inheritdoc IModuleManager - function grantRole(bytes32 role, address account) external onlyModule { - if (!hasRole(_msgSender(), role, account)) { - _moduleRoles[_msgSender()][role][account] = true; - emit ModuleRoleGranted(_msgSender(), role, account); - } - } - - /// @inheritdoc IModuleManager - function revokeRole(bytes32 role, address account) external onlyModule { - if (hasRole(_msgSender(), role, account)) { - _moduleRoles[_msgSender()][role][account] = false; - emit ModuleRoleRevoked(_msgSender(), role, account); - } - } - - //-------------------------------------------------------------------------- - // Public Mutating Functions - - /// @inheritdoc IModuleManager - function renounceRole(address module, bytes32 role) external { - if (hasRole(module, role, _msgSender())) { - _moduleRoles[module][role][_msgSender()] = false; - emit ModuleRoleRevoked(module, role, _msgSender()); - } - } - //-------------------------------------------------------------------------- // Private Functions diff --git a/test/modules/authorizer/RoleAuthorizer.t.sol b/test/modules/authorizer/RoleAuthorizer.t.sol index 743e8a1ce..e71f487c8 100644 --- a/test/modules/authorizer/RoleAuthorizer.t.sol +++ b/test/modules/authorizer/RoleAuthorizer.t.sol @@ -78,18 +78,12 @@ contract RoleAuthorizerTest is Test { abi.encode(initialAuth, initialManager) ); assertEq( - _authorizer.hasRole( - _authorizer.getManagerRole(), address(this) - ), + _authorizer.hasRole(_authorizer.getManagerRole(), address(this)), true ); + assertEq(_authorizer.hasRole(_authorizer.getOwnerRole(), ALBA), true); assertEq( - _authorizer.hasRole(_authorizer.getOwnerRole(), ALBA), true - ); - assertEq( - _authorizer.hasRole( - _authorizer.getOwnerRole(), address(this) - ), + _authorizer.hasRole(_authorizer.getOwnerRole(), address(this)), false ); } @@ -118,10 +112,7 @@ contract RoleAuthorizerTest is Test { assertEq(testAuthorizer.isAuthorized(0, address(this)), false); assertEq( - testAuthorizer.getRoleMemberCount( - testAuthorizer.getOwnerRole() - ), - 1 + testAuthorizer.getRoleMemberCount(testAuthorizer.getOwnerRole()), 1 ); } @@ -144,10 +135,7 @@ contract RoleAuthorizerTest is Test { assertEq(testAuthorizer.isAuthorized(0, address(this)), true); assertEq( - testAuthorizer.getRoleMemberCount( - testAuthorizer.getOwnerRole() - ), - 1 + testAuthorizer.getRoleMemberCount(testAuthorizer.getOwnerRole()), 1 ); } @@ -167,9 +155,7 @@ contract RoleAuthorizerTest is Test { assertEq(_authorizer.isAuthorized(0, address(this)), false); assertEq(address(_authorizer.proposal()), address(_proposal)); assertEq(_authorizer.isAuthorized(0, ALBA), true); - assertEq( - _authorizer.getRoleMemberCount(_authorizer.getOwnerRole()), 1 - ); + assertEq(_authorizer.getRoleMemberCount(_authorizer.getOwnerRole()), 1); } function testInit2RoleAuthorizer() public { @@ -212,9 +198,7 @@ contract RoleAuthorizerTest is Test { vm.startPrank(address(ALBA)); for (uint i; i < newAuthorized.length; ++i) { - _authorizer.grantRole( - _authorizer.getOwnerRole(), newAuthorized[i] - ); + _authorizer.grantRole(_authorizer.getOwnerRole(), newAuthorized[i]); } vm.stopPrank(); @@ -237,9 +221,7 @@ contract RoleAuthorizerTest is Test { vm.startPrank(address(ALBA)); _authorizer.grantRole(_authorizer.getOwnerRole(), BOB); //Meet your new Manager vm.stopPrank(); - assertEq( - _authorizer.hasRole(_authorizer.getOwnerRole(), BOB), true - ); + assertEq(_authorizer.hasRole(_authorizer.getOwnerRole(), BOB), true); uint amountAuth = _authorizer.getRoleMemberCount(_authorizer.getOwnerRole()); @@ -248,9 +230,7 @@ contract RoleAuthorizerTest is Test { _authorizer.revokeRole(_authorizer.getOwnerRole(), ALBA); vm.stopPrank(); - assertEq( - _authorizer.hasRole(_authorizer.getOwnerRole(), ALBA), false - ); + assertEq(_authorizer.hasRole(_authorizer.getOwnerRole(), ALBA), false); assertEq( _authorizer.getRoleMemberCount(_authorizer.getOwnerRole()), amountAuth - 1 diff --git a/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol b/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol index f6007f979..02c2ed68c 100644 --- a/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol +++ b/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol @@ -64,18 +64,12 @@ contract TokenGatedRoleAuthorizerUpstreamTests is RoleAuthorizerTest { abi.encode(initialAuth, initialManager) ); assertEq( - _authorizer.hasRole( - _authorizer.getManagerRole(), address(this) - ), + _authorizer.hasRole(_authorizer.getManagerRole(), address(this)), true ); + assertEq(_authorizer.hasRole(_authorizer.getOwnerRole(), ALBA), true); assertEq( - _authorizer.hasRole(_authorizer.getOwnerRole(), ALBA), true - ); - assertEq( - _authorizer.hasRole( - _authorizer.getOwnerRole(), address(this) - ), + _authorizer.hasRole(_authorizer.getOwnerRole(), address(this)), false ); } @@ -145,18 +139,12 @@ contract TokenGatedRoleAuthorizerTest is Test { abi.encode(initialAuth, initialManager) ); assertEq( - _authorizer.hasRole( - _authorizer.getManagerRole(), address(this) - ), + _authorizer.hasRole(_authorizer.getManagerRole(), address(this)), true ); + assertEq(_authorizer.hasRole(_authorizer.getOwnerRole(), ALBA), true); assertEq( - _authorizer.hasRole(_authorizer.getOwnerRole(), ALBA), true - ); - assertEq( - _authorizer.hasRole( - _authorizer.getOwnerRole(), address(this) - ), + _authorizer.hasRole(_authorizer.getOwnerRole(), address(this)), false ); diff --git a/test/proposal/base/ModuleManager.t.sol b/test/proposal/base/ModuleManager.t.sol index 5788e9b7b..da4cb798a 100644 --- a/test/proposal/base/ModuleManager.t.sol +++ b/test/proposal/base/ModuleManager.t.sol @@ -347,147 +347,5 @@ contract ModuleManagerTest is Test { moduleManager.removeModule(who); } - //-------------------------------------------------------------------------- - // Tests: Module Access Control - - function testGrantRole(address module, bytes32 role, address account) - public - { - moduleManager = new ModuleManagerMock(); - types = new TypeSanityHelper(address(moduleManager)); - - types.assumeValidModule(module); - - address[] memory modules = new address[](1); - modules[0] = module; - - moduleManager.init(modules); - - vm.prank(module); - moduleManager.grantRole(role, account); - - assertTrue(moduleManager.hasRole(module, role, account)); - } - - function testGrantRoleFailsIfCallerNotModule( - address caller, - address module, - bytes32 role, - address account - ) public { - moduleManager = new ModuleManagerMock(); - types = new TypeSanityHelper(address(moduleManager)); - - types.assumeValidModule(module); - vm.assume(caller != module); - - address[] memory modules = new address[](1); - modules[0] = module; - - moduleManager.init(modules); - - vm.prank(caller); - vm.expectRevert( - IModuleManager - .Proposal__ModuleManager__OnlyCallableByModule - .selector - ); - moduleManager.grantRole(role, account); - } - - function testRevokeRole(address module, bytes32 role, address account) - public - { - moduleManager = new ModuleManagerMock(); - types = new TypeSanityHelper(address(moduleManager)); - - types.assumeValidModule(module); - - address[] memory modules = new address[](1); - modules[0] = module; - - moduleManager.init(modules); - - vm.startPrank(module); - { - moduleManager.grantRole(role, account); - moduleManager.revokeRole(role, account); - } - vm.stopPrank(); - - assertTrue(!moduleManager.hasRole(module, role, account)); - } - - function testRevokeRoleFailsIfCallerNotModule( - address caller, - address module, - bytes32 role, - address account - ) public { - moduleManager = new ModuleManagerMock(); - types = new TypeSanityHelper(address(moduleManager)); - - types.assumeValidModule(module); - vm.assume(caller != module); - - address[] memory modules = new address[](1); - modules[0] = module; - - moduleManager.init(modules); - - vm.prank(caller); - vm.expectRevert( - IModuleManager - .Proposal__ModuleManager__OnlyCallableByModule - .selector - ); - moduleManager.revokeRole(role, account); - } - - function testRenounceRole(address module, bytes32 role, address account) - public - { - moduleManager = new ModuleManagerMock(); - types = new TypeSanityHelper(address(moduleManager)); - - types.assumeValidModule(module); - - address[] memory modules = new address[](1); - modules[0] = module; - - moduleManager.init(modules); - - vm.prank(module); - moduleManager.grantRole(role, account); - - vm.prank(account); - moduleManager.renounceRole(module, role); - - assertTrue(!moduleManager.hasRole(module, role, account)); - } - - function testRolesDisabledIfModuleDisabled( - address module, - bytes32 role, - address account - ) public { - moduleManager = new ModuleManagerMock(); - types = new TypeSanityHelper(address(moduleManager)); - - types.assumeValidModule(module); - - address[] memory modules = new address[](1); - modules[0] = module; - - moduleManager.init(modules); - - vm.prank(module); - moduleManager.grantRole(role, account); - - // Remove module. - moduleManager.__ModuleManager_setIsAuthorized(address(this), true); - moduleManager.removeModule(module); - - assertTrue(!moduleManager.hasRole(module, role, account)); - } + } diff --git a/test/utils/mocks/modules/AuthorizerMock.sol b/test/utils/mocks/modules/AuthorizerMock.sol index 7b006b1af..0ec0581af 100644 --- a/test/utils/mocks/modules/AuthorizerMock.sol +++ b/test/utils/mocks/modules/AuthorizerMock.sol @@ -1,6 +1,8 @@ // SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.0; +import "forge-std/console.sol"; + import {Module, IModule, IProposal} from "src/modules/base/Module.sol"; import {IAuthorizer} from "src/modules/authorizer/IAuthorizer.sol"; @@ -35,6 +37,13 @@ contract AuthorizerMock is IRoleAuthorizer, Module { require(authorized != address(0), "Zero address can not be authorized"); _authorized[authorized] = true; + + _roleAuthorized[generateRoleId(address(proposal()), uint8(0))][msg + .sender] = true; + _roleAuthorized[generateRoleId(address(proposal()), uint8(1))][msg + .sender] = true; + + console.log(msg.sender); } function mockInit(bytes memory configdata) public { @@ -61,6 +70,8 @@ contract AuthorizerMock is IRoleAuthorizer, Module { { return _authorized[who] || _roleAuthorized[generateRoleId(msg.sender, role)][who] + || _roleAuthorized[generateRoleId(address(proposal()), uint8(0))][who] + || _roleAuthorized[generateRoleId(address(proposal()), uint8(1))][who] || _allAuthorized; } @@ -103,20 +114,18 @@ contract AuthorizerMock is IRoleAuthorizer, Module { function grantRole(bytes32, address) external {} function hasRole(bytes32 role, address who) external view returns (bool) { - return _authorized[who] - || _roleAuthorized[role][who] - || _allAuthorized; + return _authorized[who] || _roleAuthorized[role][who] || _allAuthorized; } function revokeRole(bytes32, address) external pure {} function renounceRole(bytes32, address) external pure {} - function getOwnerRole() external pure returns(bytes32) { - return 0; + function getOwnerRole() external view returns (bytes32) { + return generateRoleId(address(proposal()), uint8(0)); } - function getManagerRole() external pure returns(bytes32){ - return 0; + function getManagerRole() external view returns (bytes32) { + return generateRoleId(address(proposal()), uint8(1)); } } From 90923acbb0aebf94fd989eb1005b992939d80097 Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Tue, 1 Aug 2023 16:53:42 +0200 Subject: [PATCH 04/32] make roleAuthorizer default --- src/factories/ProposalFactory.sol | 2 +- src/modules/authorizer/IAuthorizer.sol | 76 +- src/modules/authorizer/IRoleAuthorizer.sol | 81 -- .../authorizer/ISingleVoteGovernor.sol | 2 +- .../authorizer/ITokenGatedRoleAuthorizer.sol | 4 +- src/modules/authorizer/RoleAuthorizer.sol | 36 +- src/modules/authorizer/SingleVoteGovernor.sol | 4 +- .../authorizer/TokenGatedRoleAuthorizer.sol | 4 +- src/modules/base/Module.sol | 23 +- src/modules/logicModule/BountyManager.sol | 6 +- src/proposal/IProposal.sol | 6 +- src/proposal/Proposal.sol | 27 +- test/e2e/CreateNewProposal.t.sol | 4 +- test/factories/ProposalFactory.t.sol | 5 +- test/modules/MetadataManager.t.sol | 3 + test/modules/ModuleTest.sol | 2 +- test/modules/authorizer/RoleAuthorizer.t.sol | 14 +- .../authorizer/SingleVoteGovernor.t.sol | 1255 ----------------- .../authorizer/TokenGatedRoleAuthorizer.t.sol | 6 +- test/modules/base/Module.t.sol | 2 +- .../logicModule/MilestoneManager.t.sol | 21 +- test/proposal/Proposal.t.sol | 38 +- test/proposal/base/ModuleManager.t.sol | 2 - test/utils/mocks/modules/AuthorizerMock.sol | 7 +- 24 files changed, 182 insertions(+), 1448 deletions(-) diff --git a/src/factories/ProposalFactory.sol b/src/factories/ProposalFactory.sol index f6c6203fc..3e1d3c900 100644 --- a/src/factories/ProposalFactory.sol +++ b/src/factories/ProposalFactory.sol @@ -121,7 +121,7 @@ contract ProposalFactory is IProposalFactory { // Initialize proposal. IProposal(clone).init( _proposalIdCounter, - proposalConfig.owner, + // proposalConfig.owner, proposalConfig.token, modules, IFundingManager(fundingManager), diff --git a/src/modules/authorizer/IAuthorizer.sol b/src/modules/authorizer/IAuthorizer.sol index 588add0fd..abe309a7a 100644 --- a/src/modules/authorizer/IAuthorizer.sol +++ b/src/modules/authorizer/IAuthorizer.sol @@ -1,8 +1,82 @@ // SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.0; -interface IAuthorizer { +import {IAccessControlEnumerableUpgradeable} from + "@oz-up/access/IAccessControlEnumerableUpgradeable.sol"; + +interface IAuthorizer is IAccessControlEnumerableUpgradeable { + //-------------------------------------------------------------------------- + // Events + + /// @notice Event emitted when a module toggles self management + /// @param who The module. + /// @param newValue The new value of the self management flag. + event setRoleSelfManagement(address who, bool newValue); + + //-------------------------------------------------------------------------- + // Errors + + /// @notice The function is only callable by an active Module. + error Module__RoleAuthorizer__NotActiveModule(address module); + + /// @notice The function is only callable if the Module is self-managing its roles. + error Module__RoleAuthorizer__ModuleNotSelfManaged(); + + /// @notice There always needs to be at least one owner. + error Module__RoleAuthorizer__OwnerRoleCannotBeEmpty(); + + //-------------------------------------------------------------------------- + // Overloaded and overriden functions + /// @notice Returns if an address is authorized to perform a specific action /// @param who The adress to be checked. function isAuthorized(address who) external view returns (bool); + + /// @notice Overloads {isAuthorized} for a Module to ask whether an address holds the required role to execute + /// the current transaction. + /// @param role The identifier of the role we want to check + /// @param who The address on which to perform the check. + /// @dev If the role is not self-managed, it will default to the proposal roles + /// @dev If not, it will use the calling address to generate the role ID. Therefore, for checking on anything other than itself, hasRole() should be used + function isAuthorized(uint8 role, address who) + external + view + returns (bool); + + //-------------------------------------------------------------------------- + // Functions + + /// @notice Helper function to generate a bytes32 role hash for a module role + /// @param module The address of the module to generate the hash for + /// @param role The ID number of the role to generate the hash for + function generateRoleId(address module, uint8 role) + external + returns (bytes32); + + /// @notice Used by a Module to grant a role to a user. + /// @param role The identifier of the role to grant + /// @param target The address to which to grant the role. + function grantRoleFromModule(uint8 role, address target) external; + + /// @notice Used by a Module to revoke a role from a user. + /// @param role The identifier of the role to revoke + /// @param target The address to revoke the role from. + function revokeRoleFromModule(uint8 role, address target) external; + + /// @notice Toggles if a Module self-manages its roles or defaults to the proposal's roles. + function toggleModuleSelfManagement() external; + + /// @notice Transfer the admin rights to a given role. + /// @param roleId The role on which to peform the admin transfer + /// @param newAdmin The new role to which to transfer admin access to + function transferAdminRole(bytes32 roleId, bytes32 newAdmin) external; + + /// @notice Irreversibly burns the admin of a given role. + /// @param role The role to remove admin access from + /// @dev The module itself can still grant and revoke it's own roles. This only burns third-party access to the role. + function burnAdminRole(uint8 role) external; + + function getOwnerRole() external returns (bytes32); + + function getManagerRole() external returns (bytes32); } diff --git a/src/modules/authorizer/IRoleAuthorizer.sol b/src/modules/authorizer/IRoleAuthorizer.sol index 4bc0ab030..8b1378917 100644 --- a/src/modules/authorizer/IRoleAuthorizer.sol +++ b/src/modules/authorizer/IRoleAuthorizer.sol @@ -1,82 +1 @@ -// SPDX-License-Identifier: LGPL-3.0-only -pragma solidity ^0.8.0; -import {IAuthorizer} from "src/modules/authorizer/IAuthorizer.sol"; -import {IAccessControlEnumerableUpgradeable} from - "@oz-up/access/IAccessControlEnumerableUpgradeable.sol"; - -interface IRoleAuthorizer is - IAuthorizer, - IAccessControlEnumerableUpgradeable -{ - //-------------------------------------------------------------------------- - // Events - - /// @notice Event emitted when a module toggles self management - /// @param who The module. - /// @param newValue The new value of the self management flag. - event setRoleSelfManagement(address who, bool newValue); - - //-------------------------------------------------------------------------- - // Errors - - /// @notice The function is only callable by an active Module. - error Module__RoleAuthorizer__NotActiveModule(address module); - - /// @notice The function is only callable if the Module is self-managing its roles. - error Module__RoleAuthorizer__ModuleNotSelfManaged(); - - /// @notice There always needs to be at least one owner. - error Module__RoleAuthorizer__OwnerRoleCannotBeEmpty(); - - //-------------------------------------------------------------------------- - // Overloaded and overriden functions - - /// @notice Overloads {isAuthorized} for a Module to ask whether an address holds the required role to execute - /// the current transaction. - /// @param role The identifier of the role we want to check - /// @param who The address on which to perform the check. - /// @dev If the role is not self-managed, it will default to the proposal roles - /// @dev If not, it will use the calling address to generate the role ID. Therefore, for checking on anything other than itself, hasRole() should be used - function isAuthorized(uint8 role, address who) - external - view - returns (bool); - - //-------------------------------------------------------------------------- - // Functions - - /// @notice Helper function to generate a bytes32 role hash for a module role - /// @param module The address of the module to generate the hash for - /// @param role The ID number of the role to generate the hash for - function generateRoleId(address module, uint8 role) - external - returns (bytes32); - - /// @notice Used by a Module to grant a role to a user. - /// @param role The identifier of the role to grant - /// @param target The address to which to grant the role. - function grantRoleFromModule(uint8 role, address target) external; - - /// @notice Used by a Module to revoke a role from a user. - /// @param role The identifier of the role to revoke - /// @param target The address to revoke the role from. - function revokeRoleFromModule(uint8 role, address target) external; - - /// @notice Toggles if a Module self-manages its roles or defaults to the proposal's roles. - function toggleModuleSelfManagement() external; - - /// @notice Transfer the admin rights to a given role. - /// @param roleId The role on which to peform the admin transfer - /// @param newAdmin The new role to which to transfer admin access to - function transferAdminRole(bytes32 roleId, bytes32 newAdmin) external; - - /// @notice Irreversibly burns the admin of a given role. - /// @param role The role to remove admin access from - /// @dev The module itself can still grant and revoke it's own roles. This only burns third-party access to the role. - function burnAdminRole(uint8 role) external; - - function getOwnerRole() external returns (bytes32); - - function getManagerRole() external returns (bytes32); -} diff --git a/src/modules/authorizer/ISingleVoteGovernor.sol b/src/modules/authorizer/ISingleVoteGovernor.sol index eab1df08f..a4e28bc02 100644 --- a/src/modules/authorizer/ISingleVoteGovernor.sol +++ b/src/modules/authorizer/ISingleVoteGovernor.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {IAuthorizer} from "src/modules/authorizer/IAuthorizer.sol"; -interface ISingleVoteGovernor is IAuthorizer { +interface ISingleVoteGovernor { //-------------------------------------------------------------------------- // Types diff --git a/src/modules/authorizer/ITokenGatedRoleAuthorizer.sol b/src/modules/authorizer/ITokenGatedRoleAuthorizer.sol index e36f8cfe0..7d5b51f1f 100644 --- a/src/modules/authorizer/ITokenGatedRoleAuthorizer.sol +++ b/src/modules/authorizer/ITokenGatedRoleAuthorizer.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.0; -import {IRoleAuthorizer} from "src/modules/authorizer/IRoleAuthorizer.sol"; +import {IAuthorizer} from "src/modules/authorizer/IAuthorizer.sol"; -interface ITokenGatedRoleAuthorizer is IRoleAuthorizer { +interface ITokenGatedRoleAuthorizer is IAuthorizer { //-------------------------------------------------------------------------- // Events diff --git a/src/modules/authorizer/RoleAuthorizer.sol b/src/modules/authorizer/RoleAuthorizer.sol index 9c292b3de..5733e8489 100644 --- a/src/modules/authorizer/RoleAuthorizer.sol +++ b/src/modules/authorizer/RoleAuthorizer.sol @@ -6,10 +6,10 @@ import {AccessControlEnumerableUpgradeable} from "@oz-up/access/AccessControlEnumerableUpgradeable.sol"; import {Module, IModule} from "src/modules/base/Module.sol"; import {IProposal} from "src/proposal/IProposal.sol"; -import {IRoleAuthorizer, IAuthorizer} from "./IRoleAuthorizer.sol"; +import {IAuthorizer} from "./IAuthorizer.sol"; contract RoleAuthorizer is - IRoleAuthorizer, + IAuthorizer, AccessControlEnumerableUpgradeable, Module { @@ -101,6 +101,9 @@ contract RoleAuthorizer is PROPOSAL_MANAGER_ROLE = generateRoleId(address(proposal()), uint8(CoreRoles.MANAGER)); + //We preliminarily grant admin role to the deployer + _grantRole(PROPOSAL_OWNER_ROLE, _msgSender()); + // Set up OWNER role structure: // -> set OWNER as admin of itself @@ -108,19 +111,18 @@ contract RoleAuthorizer is // -> set OWNER as admin of DEFAULT_ADMIN_ROLE _setRoleAdmin(DEFAULT_ADMIN_ROLE, PROPOSAL_OWNER_ROLE); - // grant OWNER role to user from configData. - // Note: If the initial owner is 0x0, it defaults to msgSender() - if (initialOwner == address(0)) { - _grantRole(PROPOSAL_OWNER_ROLE, _msgSender()); - } else { - _grantRole(PROPOSAL_OWNER_ROLE, initialOwner); - } - // Set up MANAGER role structure: // -> set OWNER as admin of DEFAULT_ADMIN_ROLE _setRoleAdmin(PROPOSAL_MANAGER_ROLE, PROPOSAL_OWNER_ROLE); // grant MANAGER Role to specified address _grantRole(PROPOSAL_MANAGER_ROLE, initialManager); + + // If there is an initial owner specified, we set it as owner and remove the deployer + // Note: If the initial owner is 0x0, it stays as msgSender() + if (initialOwner != address(0)) { + _grantRole(PROPOSAL_OWNER_ROLE, initialOwner); + renounceRole(PROPOSAL_OWNER_ROLE, _msgSender()); + } } //-------------------------------------------------------------------------- @@ -150,7 +152,7 @@ contract RoleAuthorizer is return hasRole(PROPOSAL_OWNER_ROLE, who); } - /// @inheritdoc IRoleAuthorizer + /// @inheritdoc IAuthorizer function isAuthorized(uint8 role, address who) external view @@ -169,7 +171,7 @@ contract RoleAuthorizer is return hasRole(roleId, who); } - /// @inheritdoc IRoleAuthorizer + /// @inheritdoc IAuthorizer function generateRoleId(address module, uint8 role) public pure @@ -181,7 +183,7 @@ contract RoleAuthorizer is // State-altering functions - /// @inheritdoc IRoleAuthorizer + /// @inheritdoc IAuthorizer function toggleModuleSelfManagement() external onlyModule(_msgSender()) { if (selfManagedModules[_msgSender()]) { selfManagedModules[_msgSender()] = false; @@ -192,7 +194,7 @@ contract RoleAuthorizer is } } - /// @inheritdoc IRoleAuthorizer + /// @inheritdoc IAuthorizer function grantRoleFromModule(uint8 role, address target) external onlyModule(_msgSender()) @@ -202,7 +204,7 @@ contract RoleAuthorizer is _grantRole(roleId, target); } - /// @inheritdoc IRoleAuthorizer + /// @inheritdoc IAuthorizer function revokeRoleFromModule(uint8 role, address target) external onlyModule(_msgSender()) @@ -212,7 +214,7 @@ contract RoleAuthorizer is _revokeRole(roleId, target); } - /// @inheritdoc IRoleAuthorizer + /// @inheritdoc IAuthorizer function transferAdminRole(bytes32 roleId, bytes32 newAdmin) external onlyRole(getRoleAdmin(roleId)) @@ -220,7 +222,7 @@ contract RoleAuthorizer is _setRoleAdmin(roleId, newAdmin); } - /// @inheritdoc IRoleAuthorizer + /// @inheritdoc IAuthorizer function burnAdminRole(uint8 role) external onlyModule(_msgSender()) diff --git a/src/modules/authorizer/SingleVoteGovernor.sol b/src/modules/authorizer/SingleVoteGovernor.sol index c7b038d4b..90081cc4a 100644 --- a/src/modules/authorizer/SingleVoteGovernor.sol +++ b/src/modules/authorizer/SingleVoteGovernor.sol @@ -143,7 +143,7 @@ contract SingleVoteGovernor is ISingleVoteGovernor, Module { //-------------------------------------------------------------------------- // IAuthorizer Functions - /// @inheritdoc IAuthorizer + /* /// @inheritdoc IAuthorizer function isAuthorized(address who) public view @@ -152,7 +152,7 @@ contract SingleVoteGovernor is ISingleVoteGovernor, Module { { // Note that only the governance itself is authorized. return who == address(this); - } + } */ //-------------------------------------------------------------------------- // Data Retrieval Functions diff --git a/src/modules/authorizer/TokenGatedRoleAuthorizer.sol b/src/modules/authorizer/TokenGatedRoleAuthorizer.sol index 80c2ef49a..6ca4cab55 100644 --- a/src/modules/authorizer/TokenGatedRoleAuthorizer.sol +++ b/src/modules/authorizer/TokenGatedRoleAuthorizer.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.19; // External Libraries import {ITokenGatedRoleAuthorizer} from "./ITokenGatedRoleAuthorizer.sol"; -import {IRoleAuthorizer, RoleAuthorizer} from "./RoleAuthorizer.sol"; +import {IAuthorizer, RoleAuthorizer} from "./RoleAuthorizer.sol"; interface TokenInterface { function balanceOf(address _owner) external view returns (uint balance); @@ -62,7 +62,7 @@ contract TokenGatedRoleAuthorizer is function isAuthorized(uint8 role, address who) public view - override(RoleAuthorizer, IRoleAuthorizer) + override(RoleAuthorizer, IAuthorizer) returns (bool) { //Note: since it uses msgSender to generate ID, this should only be used by modules. Users should call hasRole() diff --git a/src/modules/base/Module.sol b/src/modules/base/Module.sol index 768abe128..8105a966a 100644 --- a/src/modules/base/Module.sol +++ b/src/modules/base/Module.sol @@ -11,7 +11,7 @@ import {LibMetadata} from "src/modules/lib/LibMetadata.sol"; // Internal Interfaces import {IModule, IProposal} from "src/modules/base/IModule.sol"; import {IAuthorizer} from "src/modules/authorizer/IAuthorizer.sol"; -import {IRoleAuthorizer} from "src/modules/authorizer/IRoleAuthorizer.sol"; +import {IAuthorizer} from "src/modules/authorizer/IAuthorizer.sol"; /** * @title Module @@ -62,8 +62,8 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { /// @notice Modifier to guarantee function is only callable by addresses /// authorized via Proposal. modifier onlyProposalOwner() { - IRoleAuthorizer authorizer = - IRoleAuthorizer(address(__Module_proposal.authorizer())); + IAuthorizer authorizer = + IAuthorizer(address(__Module_proposal.authorizer())); bytes32 ownerRole = authorizer.getOwnerRole(); @@ -76,8 +76,8 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { /// @notice Modifier to guarantee function is only callable by either /// addresses authorized via Proposal or the Proposal's manager. modifier onlyProposalOwnerOrManager() { - IRoleAuthorizer authorizer = - IRoleAuthorizer(address(__Module_proposal.authorizer())); + IAuthorizer authorizer = + IAuthorizer(address(__Module_proposal.authorizer())); bytes32 ownerRole = authorizer.getOwnerRole(); bytes32 managerRole = authorizer.getManagerRole(); @@ -94,8 +94,9 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { //@todo Reminder that this will be moved into the Module Contract at a later point of time modifier onlyModuleRole(uint8 roleId) { if ( - !IRoleAuthorizer(address(__Module_proposal.authorizer())) - .isAuthorized(roleId, _msgSender()) + !IAuthorizer(address(__Module_proposal.authorizer())).isAuthorized( + roleId, _msgSender() + ) ) { //revert Module__BountyManager__OnlyRole(roleId, address(this)); revert Module__CallerNotAuthorized(); @@ -208,8 +209,8 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { external onlyProposalOwner { - IRoleAuthorizer roleAuthorizer = - IRoleAuthorizer(address(__Module_proposal.authorizer())); + IAuthorizer roleAuthorizer = + IAuthorizer(address(__Module_proposal.authorizer())); roleAuthorizer.grantRoleFromModule(uint8(role), addr); } @@ -217,8 +218,8 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { external onlyProposalOwner { - IRoleAuthorizer roleAuthorizer = - IRoleAuthorizer(address(__Module_proposal.authorizer())); + IAuthorizer roleAuthorizer = + IAuthorizer(address(__Module_proposal.authorizer())); roleAuthorizer.revokeRoleFromModule(uint8(role), addr); } diff --git a/src/modules/logicModule/BountyManager.sol b/src/modules/logicModule/BountyManager.sol index 647de8bf2..d10fe362f 100644 --- a/src/modules/logicModule/BountyManager.sol +++ b/src/modules/logicModule/BountyManager.sol @@ -15,7 +15,7 @@ import {PaymentClient} from "src/modules/base/mixins/PaymentClient.sol"; // Internal Interfaces import {IProposal} from "src/proposal/IProposal.sol"; -import {IRoleAuthorizer} from "src/modules/authorizer/IRoleAuthorizer.sol"; +import {IAuthorizer} from "src/modules/authorizer/IAuthorizer.sol"; import {IBountyManager} from "src/modules/logicModule/IBountyManager.sol"; import { @@ -197,8 +197,8 @@ contract BountyManager is IBountyManager, Module, PaymentClient { { //Note: due to the authorizer still not being set during initialization, // this function has to be called after. - IRoleAuthorizer(address(proposal().authorizer())) - .toggleModuleSelfManagement(); + IAuthorizer(address(proposal().authorizer())).toggleModuleSelfManagement( + ); } //-------------------------------------------------------------------------- diff --git a/src/proposal/IProposal.sol b/src/proposal/IProposal.sol index 1e49b777c..045fdad05 100644 --- a/src/proposal/IProposal.sol +++ b/src/proposal/IProposal.sol @@ -42,7 +42,7 @@ interface IProposal is IModuleManager { /// @notice Initialization function. function init( uint proposalId, - address owner, + /*address owner, */ IERC20 token, address[] calldata modules, IFundingManager fundingManager, @@ -96,10 +96,6 @@ interface IProposal is IModuleManager { /// @notice The version of the proposal instance. function version() external pure returns (string memory); - function owner() external view returns (address); - - function manager() external view returns (address); - /// @notice find the address of a given module using it's name in a proposal function findModuleAddressInProposal(string calldata moduleName) external diff --git a/src/proposal/Proposal.sol b/src/proposal/Proposal.sol index 069b4e280..75394109c 100644 --- a/src/proposal/Proposal.sol +++ b/src/proposal/Proposal.sol @@ -40,7 +40,7 @@ import {IModule} from "src/modules/base/IModule.sol"; * * @author Inverter Network */ -contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { +contract Proposal is IProposal, ModuleManager { //-------------------------------------------------------------------------- // Modifiers @@ -59,8 +59,10 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { /// @notice Modifier to guarantee function is only callable by authorized /// address or manager. modifier onlyProposalOwnerOrManager() { - if (!authorizer.isAuthorized(_msgSender()) && _msgSender() != manager()) - { + if ( + !authorizer.isAuthorized(_msgSender()) + && !authorizer.hasRole(authorizer.getManagerRole(), _msgSender()) + ) { revert Proposal__CallerNotAuthorized(); } _; @@ -93,7 +95,7 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { /// @inheritdoc IProposal function init( uint proposalId_, - address owner_, + /*address manager_, //we need to remove this*/ IERC20 token_, address[] calldata modules, IFundingManager fundingManager_, @@ -101,7 +103,6 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { IPaymentProcessor paymentProcessor_ ) external override(IProposal) initializer { // Initialize upstream contracts. - __Ownable_init(); __ModuleManager_init(modules); // Set storage variables. @@ -114,7 +115,8 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { paymentProcessor = paymentProcessor_; // Transfer ownerhsip of proposal to owner argument. - _transferOwnership(owner_); + //_transferOwnership(manager_); + //authorizer.grantRole(authorizer.getManagerRole(), manager_); // Add necessary modules. // Note to not use the public addModule function as the factory @@ -340,17 +342,4 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { function version() external pure returns (string memory) { return "1"; } - - function owner() - public - view - override(OwnableUpgradeable, IProposal) - returns (address) - { - return super.owner(); - } - - function manager() public view returns (address) { - return owner(); - } } diff --git a/test/e2e/CreateNewProposal.t.sol b/test/e2e/CreateNewProposal.t.sol index 1d1ae37c0..48ba9e9eb 100644 --- a/test/e2e/CreateNewProposal.t.sol +++ b/test/e2e/CreateNewProposal.t.sol @@ -11,7 +11,7 @@ import { } from "src/modules/fundingManager/RebasingFundingManager.sol"; import { - IRoleAuthorizer, + IAuthorizer, RoleAuthorizer } from "src/modules/authorizer/RoleAuthorizer.sol"; @@ -63,7 +63,7 @@ import {IAuthorizer} from "src/modules/authorizer/IAuthorizer.sol"; contract ProposalCreation is Test { //Module Templates IFundingManager fundingManagerTemplate; //This is just the template thats referenced in the Factory later - IRoleAuthorizer authorizerTemplate; //Just a template + IAuthorizer authorizerTemplate; //Just a template IPaymentProcessor paymentProcessorTemplate; //Just a template IMilestoneManager milestoneManagerTemplate; //Just a template IMetadataManager metadataManagerTemplate; //Just a template diff --git a/test/factories/ProposalFactory.t.sol b/test/factories/ProposalFactory.t.sol index d4fdf8f00..e6fb08997 100644 --- a/test/factories/ProposalFactory.t.sol +++ b/test/factories/ProposalFactory.t.sol @@ -132,8 +132,9 @@ contract ProposalFactoryTest is Test { assertTrue(address(proposal.paymentProcessor()) != address(0)); // Check that other proposal's dependencies correctly initialized. - // Ownable: - assertEq(proposal.manager(), address(proposalConfig.owner)); + // Ownable: TODO + //bytes32 managerRole = proposal.authorizer().getManagerRole(); + //assertTrue(proposal.authorizer().hasRole(managerRole, address(proposalConfig.owner))); // Deploy Proposal with id=2 proposal = factory.createProposal( diff --git a/test/modules/MetadataManager.t.sol b/test/modules/MetadataManager.t.sol index d5d57ac12..4aa750f44 100644 --- a/test/modules/MetadataManager.t.sol +++ b/test/modules/MetadataManager.t.sol @@ -64,6 +64,9 @@ contract MetadataManagerTest is ModuleTest { _setUpProposal(metadataManager); + // Authorize this contract for the tests + _authorizer.setIsAuthorized(address(this), true); + //Init Module metadataManager.init( _proposal, diff --git a/test/modules/ModuleTest.sol b/test/modules/ModuleTest.sol index d1bca97fd..397655473 100644 --- a/test/modules/ModuleTest.sol +++ b/test/modules/ModuleTest.sol @@ -59,7 +59,7 @@ abstract contract ModuleTest is Test { _proposal.init( _PROPOSAL_ID, - address(this), + // address(this), _token, modules, _fundingManager, diff --git a/test/modules/authorizer/RoleAuthorizer.t.sol b/test/modules/authorizer/RoleAuthorizer.t.sol index e71f487c8..ebba4c02b 100644 --- a/test/modules/authorizer/RoleAuthorizer.t.sol +++ b/test/modules/authorizer/RoleAuthorizer.t.sol @@ -6,7 +6,7 @@ import {Test} from "forge-std/Test.sol"; import { RoleAuthorizer, - IRoleAuthorizer + IAuthorizer } from "src/modules/authorizer/RoleAuthorizer.sol"; // External Libraries import {Clones} from "@oz/proxy/Clones.sol"; @@ -62,7 +62,7 @@ contract RoleAuthorizerTest is Test { modules[0] = address(module); _proposal.init( _PROPOSAL_ID, - address(this), + // address(this), _token, modules, _fundingManager, @@ -244,7 +244,7 @@ contract RoleAuthorizerTest is Test { vm.expectRevert( abi.encodeWithSelector( - IRoleAuthorizer + IAuthorizer .Module__RoleAuthorizer__OwnerRoleCannotBeEmpty .selector ) @@ -432,7 +432,7 @@ contract RoleAuthorizerTest is Test { vm.prank(newModule); vm.expectRevert( abi.encodeWithSelector( - IRoleAuthorizer.Module__RoleAuthorizer__NotActiveModule.selector, + IAuthorizer.Module__RoleAuthorizer__NotActiveModule.selector, newModule ) ); @@ -454,7 +454,7 @@ contract RoleAuthorizerTest is Test { vm.expectRevert( abi.encodeWithSelector( - IRoleAuthorizer + IAuthorizer .Module__RoleAuthorizer__ModuleNotSelfManaged .selector ) @@ -558,7 +558,7 @@ contract RoleAuthorizerTest is Test { vm.prank(newModule); vm.expectRevert( abi.encodeWithSelector( - IRoleAuthorizer.Module__RoleAuthorizer__NotActiveModule.selector, + IAuthorizer.Module__RoleAuthorizer__NotActiveModule.selector, newModule ) ); @@ -580,7 +580,7 @@ contract RoleAuthorizerTest is Test { vm.expectRevert( abi.encodeWithSelector( - IRoleAuthorizer + IAuthorizer .Module__RoleAuthorizer__ModuleNotSelfManaged .selector ) diff --git a/test/modules/authorizer/SingleVoteGovernor.t.sol b/test/modules/authorizer/SingleVoteGovernor.t.sol index 17ad21ad3..8b1378917 100644 --- a/test/modules/authorizer/SingleVoteGovernor.t.sol +++ b/test/modules/authorizer/SingleVoteGovernor.t.sol @@ -1,1256 +1 @@ -// SPDX-License-Identifier: LGPL-3.0-only -pragma solidity ^0.8.0; -import {Test} from "forge-std/Test.sol"; - -// SuT -import { - SingleVoteGovernor, - ISingleVoteGovernor -} from "src/modules/authorizer/SingleVoteGovernor.sol"; - -// External Libraries -import {Clones} from "@oz/proxy/Clones.sol"; - -// Internal Dependencies -import {Proposal} from "src/proposal/Proposal.sol"; - -// Interfaces -import {IProposal} from "src/proposal/IProposal.sol"; -import {IModule} from "src/modules/base/IModule.sol"; - -// Mocks -import {ModuleMock} from "test/utils/mocks/modules/base/ModuleMock.sol"; -import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; -import {FundingManagerMock} from - "test/utils/mocks/modules/FundingManagerMock.sol"; -import {PaymentProcessorMock} from - "test/utils/mocks/modules/PaymentProcessorMock.sol"; - -contract SingleVoteGovernorTest is Test { - bool hasDependency; - string[] dependencies = new string[](0); - - // SuT - SingleVoteGovernor _authorizer; - - Proposal _proposal; - address[] initialVoters; - address[] currentVoters; - - // Constants and other data structures - uint internal constant DEFAULT_QUORUM = 2; - uint internal constant DEFAULT_DURATION = 4 days; - // For the proposal - uint internal constant _PROPOSAL_ID = 1; - // For the metadata - uint constant MAJOR_VERSION = 1; - uint constant MINOR_VERSION = 1; - string constant URL = "https://github.com/organization/module"; - string constant TITLE = "Module"; - - IModule.Metadata _METADATA = - IModule.Metadata(MAJOR_VERSION, MINOR_VERSION, URL, TITLE); - - // Mocks - ERC20Mock internal _token = new ERC20Mock("Mock Token", "MOCK"); - FundingManagerMock _fundingManager = new FundingManagerMock(); - PaymentProcessorMock _paymentProcessor = new PaymentProcessorMock(); - ModuleMock module = new ModuleMock(); - // Mock users - // intial authorizd users - address internal constant ALBA = address(0xa1ba); - address internal constant BOB = address(0xb0b); - address internal constant COBIE = address(0xc0b1e); - ISingleVoteGovernor.Motion _bufMotion; - - function setUp() public { - // Set up a proposal - address authImpl = address(new SingleVoteGovernor()); - _authorizer = SingleVoteGovernor(Clones.clone(authImpl)); - - address impl = address(new Proposal()); - _proposal = Proposal(Clones.clone(impl)); - - address[] memory modules = new address[](1); - modules[0] = address(module); - - _proposal.init( - _PROPOSAL_ID, - address(this), - _token, - modules, - _fundingManager, - _authorizer, - _paymentProcessor - ); - - // Initialize the authorizer with 3 users - - initialVoters = new address[](3); - initialVoters[0] = ALBA; - initialVoters[1] = BOB; - initialVoters[2] = COBIE; - - uint _startingThreshold = DEFAULT_QUORUM; - uint _startingDuration = DEFAULT_DURATION; - - _authorizer.init( - IProposal(_proposal), - _METADATA, - abi.encode(initialVoters, _startingThreshold, _startingDuration) - ); - - assertEq(address(_authorizer.proposal()), address(_proposal)); - assertEq(_proposal.isModule(address(_authorizer)), true); - - assertEq(_authorizer.isAuthorized(address(_authorizer)), true); - assertEq(_authorizer.isVoter(ALBA), true); - assertEq(_authorizer.isVoter(BOB), true); - assertEq(_authorizer.isVoter(COBIE), true); - - currentVoters.push(ALBA); - currentVoters.push(BOB); - currentVoters.push(COBIE); - - // The deployer may be owner, but not authorized by default - assertEq(_authorizer.isAuthorized(address(this)), false); - assertEq(_authorizer.isAuthorized(address(_proposal)), false); - assertEq(_authorizer.isVoter(address(this)), false); - assertEq(_authorizer.isVoter(address(_proposal)), false); - - assertEq(_authorizer.voterCount(), 3); - } - - //-------------------------------------------------------------------------- - // Helper functions for common functionalities - function createVote(address callingUser, address _addr, bytes memory _msg) - public - returns (uint) - { - vm.prank(callingUser); - uint _id = _authorizer.createMotion(_addr, _msg); - return _id; - } - - function batchAddAuthorized(address[] memory users) public { - for (uint i; i < users.length; ++i) { - // We add a new address through governance. - bytes memory _encodedAction = - abi.encodeWithSignature("addVoter(address)", users[i]); - //for ease, we are assuming this is happening before any threshold changes - uint _voteID = speedrunSuccessfulVote( - address(_authorizer), _encodedAction, initialVoters - ); - _authorizer.executeMotion(_voteID); - - currentVoters.push(users[i]); - assertEq(_authorizer.isVoter(users[i]), true); - } - } - - function voteInFavor(address callingUser, uint voteID) public { - uint8 vote = 0; - vm.prank(callingUser); - _authorizer.castVote(voteID, vote); - } - - function voteAgainst(address callingUser, uint voteID) public { - uint8 vote = 1; - vm.prank(callingUser); - _authorizer.castVote(voteID, vote); - } - - function voteAbstain(address callingUser, uint voteID) public { - uint8 vote = 2; - vm.prank(callingUser); - _authorizer.castVote(voteID, vote); - } - - function speedrunSuccessfulVote( - address _target, - bytes memory _action, - address[] memory _voters - ) public returns (uint) { - if (_voters.length == 0) { - revert("Voterlist empty"); - } - uint _voteID = createVote(_voters[0], _target, _action); - - for (uint i; i < _voters.length; ++i) { - voteInFavor(_voters[i], _voteID); - } - - // the voting time passes - vm.warp(block.timestamp + _authorizer.voteDuration() + 1); - - return _voteID; - } - - function speedrunRejectedVote( - address _target, - bytes memory _action, - address[] memory _voters - ) public returns (uint) { - if (_voters.length == 0) { - revert("Voterlist empty"); - } - uint _voteID = createVote(_voters[0], _target, _action); - - for (uint i = 1; i < _authorizer.threshold(); ++i) { - if (i < _voters.length) { - voteInFavor(_voters[(i - 1)], _voteID); - } - } - - // the voting time passes - vm.warp(block.timestamp + _authorizer.voteDuration() + 1); - - return _voteID; - } - - function getMockValidVote() public view returns (address, bytes memory) { - address _moduleAddress = address(_authorizer); - bytes memory _msg = abi.encodeWithSignature("setThreshold(uint)", 1); - - return (_moduleAddress, _msg); - } - - function getFullMotionData(uint voteId) - internal - returns (ISingleVoteGovernor.Motion storage) - { - ( - address _addr, - bytes memory _act, - uint _start, - uint _end, - uint _threshold, - uint _for, - uint _against, - uint _abstain, - uint _excAt, - bool _excRes, - bytes memory _excData - ) = _authorizer.motions(voteId); - - _bufMotion.target = _addr; - _bufMotion.action = _act; - _bufMotion.startTimestamp = _start; - _bufMotion.endTimestamp = _end; - _bufMotion.requiredThreshold = _threshold; - _bufMotion.forVotes = _for; - _bufMotion.againstVotes = _against; - _bufMotion.abstainVotes = _abstain; - _bufMotion.executedAt = _excAt; - _bufMotion.executionResult = _excRes; - _bufMotion.executionReturnData = _excData; - - for (uint i; i < currentVoters.length; ++i) { - _bufMotion.receipts[currentVoters[i]] = - _authorizer.getReceipt(voteId, currentVoters[i]); - } - - return _bufMotion; - } - - //-------------------------------------------------------------------------- - // TESTS: INITIALIZATION - - function testInitWithInitialVoters(address[] memory testVoters) public { - //Checks that address list gets correctly stored on initialization - // We "reuse" the proposal created in the setup, but the proposal doesn't know about this new authorizer. - - vm.assume(testVoters.length >= 2); - _validateUserList(testVoters); - - address authImpl = address(new SingleVoteGovernor()); - SingleVoteGovernor testAuthorizer = - SingleVoteGovernor(Clones.clone(authImpl)); - - //Since the authorizer we are working with is not the default one, - // we must manually control that the fuzzer doesn't feed us its address - for (uint i; i < testVoters.length; ++i) { - vm.assume(testVoters[i] != address(testAuthorizer)); - } - - testAuthorizer.init( - IProposal(_proposal), - _METADATA, - abi.encode(testVoters, DEFAULT_QUORUM, DEFAULT_DURATION) - ); - - assertEq(address(testAuthorizer.proposal()), address(_proposal)); - - for (uint i; i < testVoters.length; ++i) { - assertEq(testAuthorizer.isVoter(testVoters[i]), true); - } - assertEq(testAuthorizer.isVoter(address(this)), false); - assertEq(testAuthorizer.voterCount(), testVoters.length); - } - - function testInitWithDuplicateInitialVotersFails( - address[] memory testVoters, - uint8 position - ) public { - //Checks that address list gets correctly stored on initialization - // We "reuse" the proposal created in the setup, but the proposal doesn't know about this new authorizer. - - vm.assume(testVoters.length >= 2); - position = uint8(bound(position, 1, testVoters.length - 1)); - - address authImpl = address(new SingleVoteGovernor()); - SingleVoteGovernor testAuthorizer = - SingleVoteGovernor(Clones.clone(authImpl)); - - _validateUserList(testVoters); - - //Since the authorizer we are working with is not the default one, - // we must manually control that the fuzzer doesn't feed us its address - for (uint i; i < testVoters.length; ++i) { - vm.assume(testVoters[i] != address(testAuthorizer)); - } - - testVoters[position] = testVoters[0]; - - vm.expectRevert( - abi.encodeWithSelector( - ISingleVoteGovernor - .Module__SingleVoteGovernor__IsAlreadyVoter - .selector - ) - ); - testAuthorizer.init( - IProposal(_proposal), - _METADATA, - abi.encode(testVoters, DEFAULT_QUORUM, DEFAULT_DURATION) - ); - } - - function testReinitFails() public { - //Create a mock new proposal - Proposal newProposal = Proposal(Clones.clone(address(new Proposal()))); - - address[] memory testVoters = new address[](1); - testVoters[0] = address(this); - - vm.expectRevert(); - _authorizer.init( - IProposal(newProposal), - _METADATA, - abi.encode( - testVoters, - DEFAULT_QUORUM, - DEFAULT_DURATION, - hasDependency, - dependencies - ) - ); - - assertEq(_authorizer.isAuthorized(address(_authorizer)), true); - assertEq(_authorizer.isVoter(ALBA), true); - assertEq(_authorizer.isVoter(BOB), true); - assertEq(_authorizer.isVoter(COBIE), true); - assertEq(_authorizer.voterCount(), 3); - } - - function testInitWithInvalidInitialVotersFails() public { - // We "reuse" the proposal created in the setup, but the proposal doesn't know about this new authorizer. - - address authImpl = address(new SingleVoteGovernor()); - SingleVoteGovernor testAuthorizer = - SingleVoteGovernor(Clones.clone(authImpl)); - - address[] memory testVoters; - vm.expectRevert( - abi.encodeWithSelector( - ISingleVoteGovernor - .Module__SingleVoteGovernor__EmptyVoters - .selector - ) - ); - testAuthorizer.init( - IProposal(_proposal), - _METADATA, - abi.encode(testVoters, DEFAULT_QUORUM, DEFAULT_DURATION) - ); - - //test faulty list (zero addresses) - testVoters = new address[](2); - - vm.expectRevert( - abi.encodeWithSelector( - ISingleVoteGovernor - .Module__SingleVoteGovernor__InvalidVoterAddress - .selector - ) - ); - testAuthorizer.init( - IProposal(_proposal), - _METADATA, - abi.encode(testVoters, DEFAULT_QUORUM, DEFAULT_DURATION) - ); - - testVoters[0] = address(testAuthorizer); - vm.expectRevert( - abi.encodeWithSelector( - ISingleVoteGovernor - .Module__SingleVoteGovernor__InvalidVoterAddress - .selector - ) - ); - testAuthorizer.init( - IProposal(_proposal), - _METADATA, - abi.encode(testVoters, DEFAULT_QUORUM, DEFAULT_DURATION) - ); - - testVoters[0] = address(_proposal); - vm.expectRevert( - abi.encodeWithSelector( - ISingleVoteGovernor - .Module__SingleVoteGovernor__InvalidVoterAddress - .selector - ) - ); - testAuthorizer.init( - IProposal(_proposal), - _METADATA, - abi.encode(testVoters, DEFAULT_QUORUM, DEFAULT_DURATION) - ); - - assertEq(address(testAuthorizer.proposal()), address(0)); - assertEq(testAuthorizer.voterCount(), 0); - } - - function testInit2SingleVoteGovernor() public { - // Attempting to call the init2 function with malformed data - // SHOULD FAIL - vm.expectRevert( - IModule.Module__NoDependencyOrMalformedDependencyData.selector - ); - _authorizer.init2(_proposal, abi.encode(123)); - - // Calling init2 for the first time with no dependency - // SHOULD FAIL - bytes memory dependencydata = abi.encode(hasDependency, dependencies); - vm.expectRevert( - IModule.Module__NoDependencyOrMalformedDependencyData.selector - ); - _authorizer.init2(_proposal, dependencydata); - - // Calling init2 for the first time with dependency = true - // SHOULD PASS - dependencydata = abi.encode(true, dependencies); - _authorizer.init2(_proposal, dependencydata); - - // Attempting to call the init2 function again. - // SHOULD FAIL - vm.expectRevert(IModule.Module__CannotCallInit2Again.selector); - _authorizer.init2(_proposal, dependencydata); - } - - //-------------------------------------------------------------------------- - // TESTS: VOTE CREATION - - // Create vote correctly - function testCreateVote() public { - (address _moduleAddress, bytes memory _msg) = getMockValidVote(); - - for (uint i; i < initialVoters.length; ++i) { - uint _voteID = createVote(ALBA, _moduleAddress, _msg); - - ISingleVoteGovernor.Motion storage _motion = - getFullMotionData(_voteID); - - assertEq(_authorizer.motionCount(), (_voteID + 1)); - assertEq(_motion.target, _moduleAddress); - assertEq(_motion.action, _msg); - assertEq(_motion.startTimestamp, block.timestamp); - assertEq(_motion.endTimestamp, (block.timestamp + DEFAULT_DURATION)); - assertEq(_motion.requiredThreshold, DEFAULT_QUORUM); - assertEq(_motion.forVotes, 0); - assertEq(_motion.againstVotes, 0); - assertEq(_motion.abstainVotes, 0); - assertEq(_motion.executedAt, 0); - assertEq(_motion.executionResult, false); - assertEq(_motion.executionReturnData, ""); - } - } - - // Fail to create a vote as non-voting address - function testUnauthorizedVoteCreation(address[] memory users) public { - _validateUserList(users); - - (address _moduleAddress, bytes memory _msg) = getMockValidVote(); - - for (uint i; i < users.length; ++i) { - assertEq(_authorizer.isVoter(users[i]), false); - vm.expectRevert( - ISingleVoteGovernor - .Module__SingleVoteGovernor__CallerNotVoter - .selector - ); - vm.prank(users[i]); - _authorizer.createMotion(_moduleAddress, _msg); - } - } - - function testUnauthorizedVoterAddition(address[] memory users) public { - _validateUserList(users); - batchAddAuthorized(users); - - for (uint i; i < users.length; ++i) { - vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); - vm.prank(users[i]); //authorized, but not Module - _authorizer.addVoter(users[i]); - } - } - - function testUnauthorizedVoterRemoval(address[] memory users) public { - _validateUserList(users); - batchAddAuthorized(users); - - for (uint i; i < users.length; ++i) { - vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); - vm.prank(users[i]); //authorized, but not Module - _authorizer.removeVoter(users[i]); - } - } - - // Add authorized address and have it create a vote - function testCreateVoteWithRecentlyAuthorizedAddress(address[] memory users) - public - { - _validateUserList(users); - - batchAddAuthorized(users); - - for (uint i; i < users.length; ++i) { - assertEq(_authorizer.isVoter(users[i]), true); - - //prank as that address, create a vote and vote on it - (address _moduleAddress, bytes memory _msg) = getMockValidVote(); - uint _newVote = createVote(users[i], _moduleAddress, _msg); - voteInFavor(users[i], _newVote); - - //assert that voting worked (also confirms that vote exists) - assertEq(_authorizer.getReceipt(_newVote, users[i]).hasVoted, true); - } - } - - //-------------------------------------------------------------------------- - // TESTS: VOTING - - // Vote in favor at the beginning and at the end of the period - function testVoteInFavor(address[] memory users) public { - _validateUserList(users); - batchAddAuthorized(users); - - //create a vote - (address _moduleAddress, bytes memory _msg) = getMockValidVote(); - uint _voteID = createVote(ALBA, _moduleAddress, _msg); - - ISingleVoteGovernor.Motion storage _motion = getFullMotionData(_voteID); - uint _votesBefore = _motion.forVotes; - - voteInFavor(ALBA, _voteID); - - uint startTime = block.timestamp; - - for (uint i; i < users.length; ++i) { - vm.warp(startTime + i); - voteInFavor(users[i], _voteID); - } - - //vote in the last possible moment - vm.warp(startTime + DEFAULT_DURATION); - voteInFavor(BOB, _voteID); - - _motion = getFullMotionData(_voteID); - - assertEq(_motion.receipts[ALBA].hasVoted, true); - assertEq(_motion.receipts[ALBA].support, 0); - - assertEq(_motion.receipts[BOB].hasVoted, true); - assertEq(_motion.receipts[BOB].support, 0); - - for (uint i; i < users.length; ++i) { - assertEq(_motion.receipts[users[i]].hasVoted, true); - assertEq(_motion.receipts[users[i]].support, 0); - } - - assertEq(_motion.forVotes, (_votesBefore + 2 + users.length)); - } - - // Fail to vote in favor as unauthorized address - function testVoteInFavorUnauthorized(address[] memory users) public { - _validateUserList(users); - - //create vote as authorized user - (address _moduleAddress, bytes memory _msg) = getMockValidVote(); - uint _voteID = createVote(ALBA, _moduleAddress, _msg); - - for (uint i; i < users.length; ++i) { - // fail to vote as unauthorized address - vm.expectRevert( - ISingleVoteGovernor - .Module__SingleVoteGovernor__CallerNotVoter - .selector - ); - voteInFavor(users[i], _voteID); - } - } - - // Vote against at the beginning and at the end of the period - function testVoteAgainst(address[] memory users) public { - _validateUserList(users); - batchAddAuthorized(users); - - //create a vote - (address _moduleAddress, bytes memory _msg) = getMockValidVote(); - uint _voteID = createVote(ALBA, _moduleAddress, _msg); - - ISingleVoteGovernor.Motion storage _motion = getFullMotionData(_voteID); - uint _votesBefore = _motion.againstVotes; - - voteAgainst(ALBA, _voteID); - - uint startTime = block.timestamp; - - for (uint i; i < users.length; ++i) { - vm.warp(startTime + i); - voteAgainst(users[i], _voteID); - } - - //vote in the last possible moment - vm.warp(startTime + DEFAULT_DURATION); - voteAgainst(BOB, _voteID); - - _motion = getFullMotionData(_voteID); - - assertEq(_motion.receipts[ALBA].hasVoted, true); - assertEq(_motion.receipts[ALBA].support, 1); - - assertEq(_motion.receipts[BOB].hasVoted, true); - assertEq(_motion.receipts[BOB].support, 1); - - for (uint i; i < users.length; ++i) { - assertEq(_motion.receipts[users[i]].hasVoted, true); - assertEq(_motion.receipts[users[i]].support, 1); - } - - assertEq(_motion.againstVotes, (_votesBefore + 2 + users.length)); - } - - // Fail to vote against as unauthorized address - function testVoteAgainstUnauthorized(address[] memory users) public { - _validateUserList(users); - //create vote - (address _moduleAddress, bytes memory _msg) = getMockValidVote(); - uint _voteID = createVote(ALBA, _moduleAddress, _msg); - - for (uint i; i < users.length; ++i) { - // fail to vote as unauthorized address - vm.expectRevert( - ISingleVoteGovernor - .Module__SingleVoteGovernor__CallerNotVoter - .selector - ); - voteAgainst(users[i], _voteID); - } - } - - // Vote abstain at the beginning and at the end of the period - function testAbstain(address[] memory users) public { - _validateUserList(users); - batchAddAuthorized(users); - - // create vote - (address _moduleAddress, bytes memory _msg) = getMockValidVote(); - uint _voteID = createVote(ALBA, _moduleAddress, _msg); - - ISingleVoteGovernor.Motion storage _motion = getFullMotionData(_voteID); - uint _votesBefore = _motion.abstainVotes; - - voteAbstain(ALBA, _voteID); - - uint startTime = block.timestamp; - - for (uint i; i < users.length; ++i) { - vm.warp(startTime + i); - voteAbstain(users[i], _voteID); - } - - //vote in the last possible moment - vm.warp(startTime + DEFAULT_DURATION); - voteAbstain(BOB, _voteID); - - ISingleVoteGovernor.Receipt memory _r = - _authorizer.getReceipt(_voteID, ALBA); - assertEq(_r.hasVoted, true); - assertEq(_r.support, 2); - - _r = _authorizer.getReceipt(_voteID, BOB); - assertEq(_r.hasVoted, true); - assertEq(_r.support, 2); - - for (uint i; i < users.length; ++i) { - _r = _authorizer.getReceipt(_voteID, users[i]); - assertEq(_r.hasVoted, true); - assertEq(_r.support, 2); - } - - _motion = getFullMotionData(_voteID); - - assertEq(_motion.receipts[ALBA].hasVoted, true); - assertEq(_motion.receipts[ALBA].support, 2); - - assertEq(_motion.receipts[BOB].hasVoted, true); - assertEq(_motion.receipts[BOB].support, 2); - - for (uint i; i < users.length; ++i) { - assertEq(_motion.receipts[users[i]].hasVoted, true); - assertEq(_motion.receipts[users[i]].support, 2); - } - - assertEq(_motion.abstainVotes, (_votesBefore + 2 + users.length)); - } - - // Fail to vote abstain as unauthorized address - function testAbstainUnauthorized(address[] memory users) public { - _validateUserList(users); - //create vote - (address _moduleAddress, bytes memory _msg) = getMockValidVote(); - uint _voteID = createVote(ALBA, _moduleAddress, _msg); - - for (uint i; i < users.length; ++i) { - // fail to vote as unauthorized address - vm.expectRevert( - ISingleVoteGovernor - .Module__SingleVoteGovernor__CallerNotVoter - .selector - ); - voteAbstain(users[i], _voteID); - } - } - - // Fail to vote after vote is closed (testing the three vote variants) - function testVoteOnExpired(uint[] memory nums) public { - //create vote - (address _moduleAddress, bytes memory _msg) = getMockValidVote(); - uint _voteID = createVote(ALBA, _moduleAddress, _msg); - - for (uint i; i < nums.length; ++i) { - nums[i] = bound(nums[i], 0, 100_000_000_000); - vm.warp(block.timestamp + DEFAULT_DURATION + 1 + nums[i]); - - // For - vm.expectRevert( - ISingleVoteGovernor - .Module__SingleVoteGovernor__MotionVotingPhaseClosed - .selector - ); - - voteInFavor(ALBA, _voteID); - - // Against - vm.expectRevert( - ISingleVoteGovernor - .Module__SingleVoteGovernor__MotionVotingPhaseClosed - .selector - ); - voteAgainst(ALBA, _voteID); - - //Abstain - vm.expectRevert( - ISingleVoteGovernor - .Module__SingleVoteGovernor__MotionVotingPhaseClosed - .selector - ); - voteAbstain(ALBA, _voteID); - } - } - - // Fail to vote on an unexisting voteID (testing the three vote variants) - function testVoteOnUnexistingID(uint160[] memory wrongIDs) public { - //create vote - (address _moduleAddress, bytes memory _msg) = getMockValidVote(); - uint _voteID = createVote(ALBA, _moduleAddress, _msg); - - for (uint i; i < wrongIDs.length; ++i) { - vm.assume(wrongIDs[i] > _voteID); - uint wrongID = wrongIDs[i]; - - // For - vm.expectRevert( - ISingleVoteGovernor - .Module__SingleVoteGovernor__InvalidMotionId - .selector - ); - - voteInFavor(ALBA, wrongID); - - // Against - vm.expectRevert( - ISingleVoteGovernor - .Module__SingleVoteGovernor__InvalidMotionId - .selector - ); - - voteAgainst(ALBA, wrongID); - - //Abstain - vm.expectRevert( - ISingleVoteGovernor - .Module__SingleVoteGovernor__InvalidMotionId - .selector - ); - voteAbstain(ALBA, wrongID); - } - } - - // Fail to vote with a different value than the allowed three - function testCastInvalidVote(uint8 wrongVote) public { - vm.assume(wrongVote > 2); - //create vote - (address _moduleAddress, bytes memory _msg) = getMockValidVote(); - uint _voteID = createVote(ALBA, _moduleAddress, _msg); - - vm.expectRevert( - ISingleVoteGovernor - .Module__SingleVoteGovernor__InvalidSupport - .selector - ); - vm.prank(ALBA); - _authorizer.castVote(_voteID, wrongVote); - } - - // Fail vote for after already voting (testing the three vote variants) - function testDoubleVoting(address[] memory users) public { - _validateUserList(users); - batchAddAuthorized(users); - //create vote - (address _moduleAddress, bytes memory _msg) = getMockValidVote(); - uint _voteID = createVote(ALBA, _moduleAddress, _msg); - - for (uint i; i < users.length; ++i) { - //vote once - voteAgainst(users[i], _voteID); - - vm.expectRevert( - ISingleVoteGovernor - .Module__SingleVoteGovernor__AttemptedDoubleVote - .selector - ); - voteInFavor(users[i], _voteID); - - vm.expectRevert( - ISingleVoteGovernor - .Module__SingleVoteGovernor__AttemptedDoubleVote - .selector - ); - voteAgainst(users[i], _voteID); - - vm.expectRevert( - ISingleVoteGovernor - .Module__SingleVoteGovernor__AttemptedDoubleVote - .selector - ); - voteAbstain(users[i], _voteID); - } - } - - //-------------------------------------------------------------------------- - // TEST: VOTE EXECUTION - - // Executing a vote that passed - function testVoteExecution() public { - // Here we will test a "standard" execution process to change the vote Duration. The process will be: - - // 1) Somebody creates a vote - uint _newDuration = 2 days; - bytes memory _encodedAction = - abi.encodeWithSignature("setVotingDuration(uint256)", _newDuration); - - // 2) The vote passes - uint _voteID = speedrunSuccessfulVote( - address(_authorizer), _encodedAction, initialVoters - ); - - // 3) The vote gets executed (by anybody) - _authorizer.executeMotion(_voteID); - - // 4) The module state has changed - assertEq(_authorizer.voteDuration(), _newDuration); - } - // Fail to execute vote that didn't pass - - function testExecuteInexistentVote(uint wrongId) public { - //No votes exist yet, everyting should fail - vm.expectRevert( - ISingleVoteGovernor - .Module__SingleVoteGovernor__InvalidMotionId - .selector - ); - _authorizer.executeMotion(wrongId); - } - - // Fail to execute vote that didn't pass - function testExecuteFailedVote() public { - (address _moduleAddress, bytes memory _encodedAction) = - getMockValidVote(); - - uint _voteID = speedrunRejectedVote( - address(_moduleAddress), _encodedAction, initialVoters - ); - - //No prank address needed - vm.expectRevert( - ISingleVoteGovernor - .Module__SingleVoteGovernor__ThresholdNotReached - .selector - ); - _authorizer.executeMotion(_voteID); - } - - //Fail to execute vote while voting is open - function testExecuteWhileVotingOpen() public { - // create vote - (address _moduleAddress, bytes memory _msg) = getMockValidVote(); - uint _voteID = createVote(ALBA, _moduleAddress, _msg); - - //First, we reach the threshold - voteInFavor(ALBA, _voteID); - voteInFavor(BOB, _voteID); - - vm.expectRevert( - abi.encodePacked( - ISingleVoteGovernor - .Module__SingleVoteGovernor__MotionInVotingPhase - .selector - ) - ); - _authorizer.executeMotion(_voteID); - - //we wait and try again in the last block of voting time - vm.warp(block.timestamp + _authorizer.voteDuration()); - - vm.expectRevert( - abi.encodePacked( - ISingleVoteGovernor - .Module__SingleVoteGovernor__MotionInVotingPhase - .selector - ) - ); - _authorizer.executeMotion(_voteID); - } - - // Fail to execute an already executed vote - function testDoubleExecution() public { - // 1) First we do a normal vote + execution - uint _newDuration = 3 days; - bytes memory _encodedAction = - abi.encodeWithSignature("setVotingDuration(uint256)", _newDuration); - - uint _voteID = speedrunSuccessfulVote( - address(_authorizer), _encodedAction, initialVoters - ); - - // 2) Then the vote gets executed by anybody - _authorizer.executeMotion(_voteID); - - // 3) the module state has changed - assertEq(_authorizer.voteDuration(), _newDuration); - - // 4) Now we test that we can't execute again: - vm.expectRevert( - abi.encodeWithSelector( - ISingleVoteGovernor - .Module__SingleVoteGovernor__MotionAlreadyExecuted - .selector - ) - ); - _authorizer.executeMotion(_voteID); - } - - function testOnlyGovernanceIsAuthorized(address _other) public { - vm.assume(_other != address(_authorizer)); - - vm.expectRevert(IProposal.Proposal__CallerNotAuthorized.selector); - vm.prank(_other); - _proposal.executeTx(address(0), ""); - } - - //-------------------------------------------------------------------------- - // TEST: VOTER MANAGEMENT - function testAddVoters(address[] memory users) public { - _validateUserList(users); - - vm.startPrank(address(_authorizer)); - for (uint i; i < users.length; ++i) { - _authorizer.addVoter(users[i]); - } - - for (uint i; i < users.length; ++i) { - assertEq(_authorizer.isVoter(users[i]), true); - } - //test idempotence. We do the same again and verify that nothing fails and everything stays the same. - for (uint i; i < users.length; ++i) { - _authorizer.addVoter(users[i]); - } - - for (uint i; i < users.length; ++i) { - assertEq(_authorizer.isVoter(users[i]), true); - } - - vm.stopPrank(); - } - - function testRemoveVoter(address[] memory users) public { - _validateUserList(users); - batchAddAuthorized(users); - - vm.startPrank(address(_authorizer)); - for (uint i; i < users.length; ++i) { - _authorizer.removeVoter(users[i]); - } - - for (uint i; i < users.length; ++i) { - assertEq(_authorizer.isVoter(users[i]), false); - } - //test idempotence. We do the same again and verify that nothing fails and everything stays the same. - for (uint i; i < users.length; ++i) { - _authorizer.removeVoter(users[i]); - } - - for (uint i; i < users.length; ++i) { - assertEq(_authorizer.isVoter(users[i]), false); - } - - vm.stopPrank(); - } - - // Fail to remove Authorized addresses until threshold is unreachble - function testRemoveTooManyVoters() public { - assertEq(address(_proposal), address(_authorizer.proposal())); - - vm.startPrank(address(_authorizer)); - _authorizer.removeVoter(COBIE); - - //this call would leave a 1 person list with a threshold of 2 - vm.expectRevert( - ISingleVoteGovernor - .Module__SingleVoteGovernor__UnreachableThreshold - .selector - ); - _authorizer.removeVoter(BOB); - - vm.stopPrank(); - } - - // Fail to remove Authorized addresses until the voterlist is empty - function testRemoveUntilVoterListEmpty() public { - assertEq(address(_proposal), address(_authorizer.proposal())); - - vm.startPrank(address(_authorizer)); - _authorizer.setThreshold(0); - - _authorizer.removeVoter(COBIE); - _authorizer.removeVoter(BOB); - - //this call would leave a 1 person list with a threshold of 2 - vm.expectRevert( - ISingleVoteGovernor.Module__SingleVoteGovernor__EmptyVoters.selector - ); - _authorizer.removeVoter(ALBA); - - vm.stopPrank(); - } - - //-------------------------------------------------------------------------- - // TEST: QUORUM - - // Get correct threshold - function testGetThreshold() public { - assertEq(_authorizer.threshold(), DEFAULT_QUORUM); - } - - // Set a new threshold - function testMotionSetThreshold() public { - uint _newQ = 1; - - vm.prank(address(_authorizer)); - _authorizer.setThreshold(_newQ); - - assertEq(_authorizer.threshold(), _newQ); - } - - // Fail to set a threshold that's too damn high - function testSetUnreachableThreshold(uint _newQ) public { - vm.assume(_newQ > _authorizer.voterCount()); - - vm.expectRevert( - ISingleVoteGovernor - .Module__SingleVoteGovernor__UnreachableThreshold - .selector - ); - vm.prank(address(_authorizer)); - _authorizer.setThreshold(_newQ); - } - - // Fail to change threshold when not the module itself - function testUnauthorizedThresholdChange(address[] memory users) public { - _validateUserList(users); - batchAddAuthorized(users); - - uint _newQ = 1; - for (uint i; i < users.length; ++i) { - vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); - vm.prank(users[i]); //authorized, but not Proposal - _authorizer.setThreshold(_newQ); - } - } - - //Change the threshold by going through governance - function testGovernanceThresholdChange() public { - uint _newThreshold = 1; - - // 1) Create and approve a vote - bytes memory _encodedAction = - abi.encodeWithSignature("setThreshold(uint256)", _newThreshold); - uint _voteID = speedrunSuccessfulVote( - address(_authorizer), _encodedAction, initialVoters - ); - - // 2) The vote gets executed by anybody - _authorizer.executeMotion(_voteID); - - // 3) The proposal state has changed - assertEq(_authorizer.threshold(), _newThreshold); - } - - //-------------------------------------------------------------------------- - // TEST: VOTE DURATION - - // Get correct vote duration - function testGetVoteDuration() public { - assertEq(_authorizer.voteDuration(), DEFAULT_DURATION); - } - - // Set new vote duration - function testMotionSetVoteDuration() public { - uint _newDur = 3 days; - - vm.prank(address(_authorizer)); - _authorizer.setVotingDuration(_newDur); - - assertEq(_authorizer.voteDuration(), _newDur); - } - - // Fail to set vote durations out of bounds - function testMotionSetInvalidVoteDuration() public { - uint _oldDur = _authorizer.voteDuration(); - uint _newDur = 3 weeks; - - vm.expectRevert( - abi.encodeWithSelector( - ISingleVoteGovernor - .Module__SingleVoteGovernor__InvalidVotingDuration - .selector - ) - ); - vm.prank(address(_authorizer)); - _authorizer.setVotingDuration(_newDur); - - _newDur = 1 hours; - - vm.expectRevert( - abi.encodeWithSelector( - ISingleVoteGovernor - .Module__SingleVoteGovernor__InvalidVotingDuration - .selector - ) - ); - vm.prank(address(_authorizer)); - _authorizer.setVotingDuration(_newDur); - - assertEq(_authorizer.voteDuration(), _oldDur); - } - - //Set new duration bygoing through governance - function testGovernanceVoteDurationChange() public { - //already covered in: - testVoteExecution(); - } - - // Fail to change vote duration when not the module itself - function testUnauthorizedGovernanceVoteDurationChange( - address[] memory users - ) public { - _validateUserList(users); - batchAddAuthorized(users); - - uint _newDuration = 5 days; - for (uint i; i < users.length; ++i) { - vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); - vm.prank(users[i]); //authorized, but not Proposal - _authorizer.setVotingDuration(_newDuration); - } - } - - // ========================================================================= - // Test Helper Functions - - function _validateUserList(address[] memory contribs) - internal - returns (address[] memory) - { - vm.assume(contribs.length != 0); - vm.assume(contribs.length < 40); - assumeValidUsers(contribs); - - return contribs; - } - // Adapted from proposal/helper/TypeSanityHelper.sol - - mapping(address => bool) userCache; - - function assumeValidUsers(address[] memory addrs) public { - for (uint i; i < addrs.length; ++i) { - assumeValidUser(addrs[i]); - - // Assume contributor address unique. - vm.assume(!userCache[addrs[i]]); - - // Add contributor address to cache. - userCache[addrs[i]] = true; - } - } - - function assumeValidUser(address a) public view { - address[] memory invalids = createInvalidUsers(); - - for (uint i; i < invalids.length; ++i) { - vm.assume(a != invalids[i]); - } - } - - function createInvalidUsers() public view returns (address[] memory) { - address[] memory invalids = new address[](10); - - invalids[0] = address(0); - invalids[1] = address(_proposal); - invalids[2] = address(_authorizer); - invalids[3] = address(_paymentProcessor); - invalids[4] = address(_token); - invalids[5] = address(module); - invalids[6] = address(this); - invalids[7] = ALBA; - invalids[8] = BOB; - invalids[9] = COBIE; - - return invalids; - } - // ========================================================================= -} diff --git a/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol b/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol index 02c2ed68c..41e3fe28f 100644 --- a/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol +++ b/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol @@ -14,7 +14,7 @@ import { import { RoleAuthorizer, - IRoleAuthorizer + IAuthorizer } from "src/modules/authorizer/RoleAuthorizer.sol"; import {IAuthorizer} from "src/modules/authorizer/IAuthorizer.sol"; // External Libraries @@ -47,7 +47,7 @@ contract TokenGatedRoleAuthorizerUpstreamTests is RoleAuthorizerTest { modules[0] = address(module); _proposal.init( _PROPOSAL_ID, - address(this), + // address(this), _token, modules, _fundingManager, @@ -122,7 +122,7 @@ contract TokenGatedRoleAuthorizerTest is Test { modules[0] = address(mockModule); _proposal.init( _PROPOSAL_ID, - address(this), + // address(this), _token, modules, _fundingManager, diff --git a/test/modules/base/Module.t.sol b/test/modules/base/Module.t.sol index be0f24133..e1ea80f2c 100644 --- a/test/modules/base/Module.t.sol +++ b/test/modules/base/Module.t.sol @@ -71,7 +71,7 @@ contract ModuleTest is Test { modules[0] = address(module); proposal.init( 1, - address(this), + // address(this), IERC20(new ERC20Mock("Mock", "MOCK")), modules, fundingManager, diff --git a/test/modules/logicModule/MilestoneManager.t.sol b/test/modules/logicModule/MilestoneManager.t.sol index e3bae86c3..b906ae7ab 100644 --- a/test/modules/logicModule/MilestoneManager.t.sol +++ b/test/modules/logicModule/MilestoneManager.t.sol @@ -474,7 +474,8 @@ contract MilestoneManagerTest is ModuleTest { public { _authorizer.setIsAuthorized(caller, false); - vm.assume(caller != _proposal.manager()); + bytes32 managerRole = _proposal.authorizer().getManagerRole(); + vm.assume(!_proposal.authorizer().hasRole(managerRole, address(caller))); vm.prank(caller); vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); @@ -654,7 +655,8 @@ contract MilestoneManagerTest is ModuleTest { uint id = 1; // Note that id's start at 1. _authorizer.setIsAuthorized(caller, false); - vm.assume(caller != _proposal.manager()); + bytes32 managerRole = _proposal.authorizer().getManagerRole(); + vm.assume(!_proposal.authorizer().hasRole(managerRole, address(caller))); vm.prank(caller); vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); @@ -827,7 +829,8 @@ contract MilestoneManagerTest is ModuleTest { address caller ) public { _authorizer.setIsAuthorized(caller, false); - vm.assume(caller != _proposal.manager()); + bytes32 managerRole = _proposal.authorizer().getManagerRole(); + vm.assume(!_proposal.authorizer().hasRole(managerRole, address(caller))); vm.prank(caller); vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); @@ -946,7 +949,8 @@ contract MilestoneManagerTest is ModuleTest { address caller ) public { _authorizer.setIsAuthorized(caller, false); - vm.assume(caller != _proposal.manager()); + bytes32 managerRole = _proposal.authorizer().getManagerRole(); + vm.assume(!_proposal.authorizer().hasRole(managerRole, address(caller))); milestoneManager.addMilestone( DURATION, BUDGET, DEFAULT_CONTRIBUTORS, DETAILS @@ -1093,7 +1097,8 @@ contract MilestoneManagerTest is ModuleTest { address caller ) public { _authorizer.setIsAuthorized(caller, false); - vm.assume(caller != _proposal.manager()); + bytes32 managerRole = _proposal.authorizer().getManagerRole(); + vm.assume(!_proposal.authorizer().hasRole(managerRole, address(caller))); uint id = milestoneManager.addMilestone( DURATION, BUDGET, DEFAULT_CONTRIBUTORS, DETAILS @@ -1566,7 +1571,8 @@ contract MilestoneManagerTest is ModuleTest { address[] memory contributors ) public { _authorizer.setIsAuthorized(caller, false); - vm.assume(caller != _proposal.manager()); + bytes32 managerRole = _proposal.authorizer().getManagerRole(); + vm.assume(!_proposal.authorizer().hasRole(managerRole, address(caller))); IMilestoneManager.Contributor[] memory contribs = _generateEqualContributors(contributors); @@ -1689,7 +1695,8 @@ contract MilestoneManagerTest is ModuleTest { address[] memory contributors ) public { _authorizer.setIsAuthorized(caller, false); - vm.assume(caller != _proposal.manager()); + bytes32 managerRole = _proposal.authorizer().getManagerRole(); + vm.assume(!_proposal.authorizer().hasRole(managerRole, address(caller))); IMilestoneManager.Contributor[] memory contribs = _generateEqualContributors(contributors); diff --git a/test/proposal/Proposal.t.sol b/test/proposal/Proposal.t.sol index 4df40df33..190e2ea03 100644 --- a/test/proposal/Proposal.t.sol +++ b/test/proposal/Proposal.t.sol @@ -68,6 +68,7 @@ contract ProposalTest is Test { function testInit(uint proposalId, address[] memory modules) public { types.assumeValidProposalId(proposalId); + types.assumeValidModules(modules); address[] memory truncatedModules = new address[](125); @@ -83,7 +84,7 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - address(this), + //address(this), token, truncatedModules, fundingManager, @@ -97,7 +98,7 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - address(this), + //address(this), token, modules, fundingManager, @@ -108,16 +109,13 @@ contract ProposalTest is Test { // Check that proposal's storage correctly initialized. assertEq(proposal.proposalId(), proposalId); - assertEq(address(proposal.manager()), address(this)); + //bytes32 managerRole = proposal.authorizer().getManagerRole(); TODO + //assertTrue(proposal.authorizer().hasRole(managerRole, address(this))); assertEq(address(proposal.token()), address(token)); assertEq(address(proposal.authorizer()), address(authorizer)); assertEq( address(proposal.paymentProcessor()), address(paymentProcessor) ); - - // Check that proposal's dependencies correctly initialized. - // Ownable: - assertEq(proposal.manager(), address(this)); } function testReinitFails(uint proposalId, address[] memory modules) @@ -138,7 +136,7 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - address(this), + //address(this), token, truncatedModules, fundingManager, @@ -149,7 +147,7 @@ contract ProposalTest is Test { vm.expectRevert(OZErrors.Initializable__AlreadyInitialized); proposal.init( proposalId, - address(this), + //address(this), token, truncatedModules, fundingManager, @@ -164,7 +162,7 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - address(this), + //address(this), token, modules, fundingManager, @@ -175,7 +173,7 @@ contract ProposalTest is Test { vm.expectRevert(OZErrors.Initializable__AlreadyInitialized); proposal.init( proposalId, - address(this), + // address(this), token, modules, fundingManager, @@ -204,7 +202,7 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - address(this), + // address(this), token, modules, fundingManager, @@ -253,7 +251,7 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - address(this), + // address(this), token, modules, fundingManager, @@ -295,7 +293,7 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - address(this), + // address(this), token, modules, fundingManager, @@ -338,7 +336,7 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - address(this), + // address(this), token, truncatedModules, fundingManager, @@ -354,7 +352,7 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - address(this), + //address(this), token, modules, fundingManager, @@ -388,7 +386,7 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - address(this), + //address(this), token, truncatedModules, fundingManager, @@ -404,7 +402,7 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - address(this), + //address(this), token, modules, fundingManager, @@ -439,7 +437,7 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - address(0xCAFE), // Note to not be the owner + //address(0xCAFE), // Note to not be the owner -> change in authmetadata? token, truncatedModules, fundingManager, @@ -455,7 +453,7 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - address(0xCAFE), // Note to not be the owner + //address(0xCAFE), // Note to not be the owner -> change in auth metadata? token, modules, fundingManager, diff --git a/test/proposal/base/ModuleManager.t.sol b/test/proposal/base/ModuleManager.t.sol index da4cb798a..59865c46e 100644 --- a/test/proposal/base/ModuleManager.t.sol +++ b/test/proposal/base/ModuleManager.t.sol @@ -346,6 +346,4 @@ contract ModuleManagerTest is Test { ); moduleManager.removeModule(who); } - - } diff --git a/test/utils/mocks/modules/AuthorizerMock.sol b/test/utils/mocks/modules/AuthorizerMock.sol index 0ec0581af..1e140fdb2 100644 --- a/test/utils/mocks/modules/AuthorizerMock.sol +++ b/test/utils/mocks/modules/AuthorizerMock.sol @@ -6,9 +6,8 @@ import "forge-std/console.sol"; import {Module, IModule, IProposal} from "src/modules/base/Module.sol"; import {IAuthorizer} from "src/modules/authorizer/IAuthorizer.sol"; -import {IRoleAuthorizer} from "src/modules/authorizer/IRoleAuthorizer.sol"; -contract AuthorizerMock is IRoleAuthorizer, Module { +contract AuthorizerMock is IAuthorizer, Module { mapping(address => bool) private _authorized; mapping(bytes32 => mapping(address => bool)) private _roleAuthorized; @@ -111,7 +110,9 @@ contract AuthorizerMock is IRoleAuthorizer, Module { return 0; } - function grantRole(bytes32, address) external {} + function grantRole(bytes32 role, address who) external { + _roleAuthorized[role][who] = true; + } function hasRole(bytes32 role, address who) external view returns (bool) { return _authorized[who] || _roleAuthorized[role][who] || _allAuthorized; From c24e26152ba888458b274a79e7dcdc987fcc6a6c Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Tue, 1 Aug 2023 18:28:11 +0200 Subject: [PATCH 05/32] fix singlevote tests --- src/modules/authorizer/RoleAuthorizer.sol | 4 +- .../StreamingPaymentProcessor.sol | 2 +- .../authorizer/SingleVoteGovernor.t.sol | 1261 +++++++++++++++++ test/modules/base/Module.t.sol | 21 + test/modules/logicModule/BountyManager.t.sol | 17 - test/utils/mocks/modules/AuthorizerMock.sol | 4 +- 6 files changed, 1288 insertions(+), 21 deletions(-) diff --git a/src/modules/authorizer/RoleAuthorizer.sol b/src/modules/authorizer/RoleAuthorizer.sol index 5733e8489..87c3b2c62 100644 --- a/src/modules/authorizer/RoleAuthorizer.sol +++ b/src/modules/authorizer/RoleAuthorizer.sol @@ -232,11 +232,11 @@ contract RoleAuthorizer is _setRoleAdmin(roleId, BURN_ADMIN_ROLE); } - function getOwnerRole() public returns (bytes32) { + function getOwnerRole() public view returns (bytes32) { return PROPOSAL_OWNER_ROLE; } - function getManagerRole() public returns (bytes32) { + function getManagerRole() public view returns (bytes32) { return PROPOSAL_MANAGER_ROLE; } } diff --git a/src/modules/paymentProcessor/StreamingPaymentProcessor.sol b/src/modules/paymentProcessor/StreamingPaymentProcessor.sol index df56e4a9b..c08187aa8 100644 --- a/src/modules/paymentProcessor/StreamingPaymentProcessor.sol +++ b/src/modules/paymentProcessor/StreamingPaymentProcessor.sol @@ -207,7 +207,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { /// @inheritdoc IStreamingPaymentProcessor function removeAllPaymentReceiverPayments( IPaymentClient client, - address contributor + address paymentReceiver ) external onlyProposalOwner { if ( _findAddressInActiveVestings(address(client), paymentReceiver) diff --git a/test/modules/authorizer/SingleVoteGovernor.t.sol b/test/modules/authorizer/SingleVoteGovernor.t.sol index 8b1378917..07dea9fa4 100644 --- a/test/modules/authorizer/SingleVoteGovernor.t.sol +++ b/test/modules/authorizer/SingleVoteGovernor.t.sol @@ -1 +1,1262 @@ +// SPDX-License-Identifier: LGPL-3.0-only +pragma solidity ^0.8.0; +import {Test} from "forge-std/Test.sol"; + +// SuT +import { + SingleVoteGovernor, + ISingleVoteGovernor +} from "src/modules/authorizer/SingleVoteGovernor.sol"; + +// External Libraries +import {Clones} from "@oz/proxy/Clones.sol"; + +// Internal Dependencies +import {Proposal} from "src/proposal/Proposal.sol"; + +// Interfaces +import {IProposal} from "src/proposal/IProposal.sol"; +import {IModule} from "src/modules/base/IModule.sol"; + +// Mocks +import {ModuleMock} from "test/utils/mocks/modules/base/ModuleMock.sol"; +import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; +import {FundingManagerMock} from + "test/utils/mocks/modules/FundingManagerMock.sol"; +import {PaymentProcessorMock} from + "test/utils/mocks/modules/PaymentProcessorMock.sol"; +import {AuthorizerMock} from "test/utils/mocks/modules/AuthorizerMock.sol"; + +contract SingleVoteGovernorTest is Test { + bool hasDependency; + string[] dependencies = new string[](0); + + // SuT + SingleVoteGovernor _governor; + + Proposal _proposal; + address[] initialVoters; + address[] currentVoters; + + // Constants and other data structures + uint internal constant DEFAULT_QUORUM = 2; + uint internal constant DEFAULT_DURATION = 4 days; + // For the proposal + uint internal constant _PROPOSAL_ID = 1; + // For the metadata + uint constant MAJOR_VERSION = 1; + uint constant MINOR_VERSION = 1; + string constant URL = "https://github.com/organization/module"; + string constant TITLE = "Module"; + + IModule.Metadata _METADATA = + IModule.Metadata(MAJOR_VERSION, MINOR_VERSION, URL, TITLE); + + // Mocks + ERC20Mock internal _token = new ERC20Mock("Mock Token", "MOCK"); + FundingManagerMock _fundingManager = new FundingManagerMock(); + PaymentProcessorMock _paymentProcessor = new PaymentProcessorMock(); + AuthorizerMock _authorizer = new AuthorizerMock(); + ModuleMock module = new ModuleMock(); + // Mock users + // intial authorizd users + address internal constant ALBA = address(0xa1ba); + address internal constant BOB = address(0xb0b); + address internal constant COBIE = address(0xc0b1e); + ISingleVoteGovernor.Motion _bufMotion; + + function setUp() public { + // Set up a proposal + address authImpl = address(new SingleVoteGovernor()); + _governor = SingleVoteGovernor(Clones.clone(authImpl)); + + address impl = address(new Proposal()); + _proposal = Proposal(Clones.clone(impl)); + + address[] memory modules = new address[](1); + modules[0] = address(_governor); + + _proposal.init( + _PROPOSAL_ID, + _token, + modules, + _fundingManager, + _authorizer, + _paymentProcessor + ); + + //we give the governor the ownwer role + bytes32 ownerRole = _authorizer.getOwnerRole(); + _authorizer.grantRole(ownerRole, address(_governor)); + //_authorizer.setIsAuthorized(address(_governor), true); + + // Initialize the authorizer with 3 users + + initialVoters = new address[](3); + initialVoters[0] = ALBA; + initialVoters[1] = BOB; + initialVoters[2] = COBIE; + + uint _startingThreshold = DEFAULT_QUORUM; + uint _startingDuration = DEFAULT_DURATION; + + _governor.init( + IProposal(_proposal), + _METADATA, + abi.encode(initialVoters, _startingThreshold, _startingDuration) + ); + + assertEq(address(_governor.proposal()), address(_proposal)); + assertEq(_proposal.isModule(address(_governor)), true); + + assertEq(_authorizer.isAuthorized(address(_governor)), true); + assertEq(_governor.isVoter(ALBA), true); + assertEq(_governor.isVoter(BOB), true); + assertEq(_governor.isVoter(COBIE), true); + + currentVoters.push(ALBA); + currentVoters.push(BOB); + currentVoters.push(COBIE); + + // The deployer may be owner, but not authorized by default + assertEq(_authorizer.isAuthorized(address(this)), false); + assertEq(_authorizer.isAuthorized(address(_proposal)), false); + assertEq(_governor.isVoter(address(this)), false); + assertEq(_governor.isVoter(address(_proposal)), false); + + assertEq(_governor.voterCount(), 3); + } + + //-------------------------------------------------------------------------- + // Helper functions for common functionalities + function createVote(address callingUser, address _addr, bytes memory _msg) + public + returns (uint) + { + vm.prank(callingUser); + uint _id = _governor.createMotion(_addr, _msg); + return _id; + } + + function batchAddAuthorized(address[] memory users) public { + for (uint i; i < users.length; ++i) { + // We add a new address through governance. + bytes memory _encodedAction = + abi.encodeWithSignature("addVoter(address)", users[i]); + //for ease, we are assuming this is happening before any threshold changes + uint _voteID = speedrunSuccessfulVote( + address(_governor), _encodedAction, initialVoters + ); + _governor.executeMotion(_voteID); + + currentVoters.push(users[i]); + assertEq(_governor.isVoter(users[i]), true); + } + } + + function voteInFavor(address callingUser, uint voteID) public { + uint8 vote = 0; + vm.prank(callingUser); + _governor.castVote(voteID, vote); + } + + function voteAgainst(address callingUser, uint voteID) public { + uint8 vote = 1; + vm.prank(callingUser); + _governor.castVote(voteID, vote); + } + + function voteAbstain(address callingUser, uint voteID) public { + uint8 vote = 2; + vm.prank(callingUser); + _governor.castVote(voteID, vote); + } + + function speedrunSuccessfulVote( + address _target, + bytes memory _action, + address[] memory _voters + ) public returns (uint) { + if (_voters.length == 0) { + revert("Voterlist empty"); + } + uint _voteID = createVote(_voters[0], _target, _action); + + for (uint i; i < _voters.length; ++i) { + voteInFavor(_voters[i], _voteID); + } + + // the voting time passes + vm.warp(block.timestamp + _governor.voteDuration() + 1); + + return _voteID; + } + + function speedrunRejectedVote( + address _target, + bytes memory _action, + address[] memory _voters + ) public returns (uint) { + if (_voters.length == 0) { + revert("Voterlist empty"); + } + uint _voteID = createVote(_voters[0], _target, _action); + + for (uint i = 1; i < _governor.threshold(); ++i) { + if (i < _voters.length) { + voteInFavor(_voters[(i - 1)], _voteID); + } + } + + // the voting time passes + vm.warp(block.timestamp + _governor.voteDuration() + 1); + + return _voteID; + } + + function getMockValidVote() public view returns (address, bytes memory) { + address _moduleAddress = address(_governor); + bytes memory _msg = abi.encodeWithSignature("setThreshold(uint)", 1); + + return (_moduleAddress, _msg); + } + + function getFullMotionData(uint voteId) + internal + returns (ISingleVoteGovernor.Motion storage) + { + ( + address _addr, + bytes memory _act, + uint _start, + uint _end, + uint _threshold, + uint _for, + uint _against, + uint _abstain, + uint _excAt, + bool _excRes, + bytes memory _excData + ) = _governor.motions(voteId); + + _bufMotion.target = _addr; + _bufMotion.action = _act; + _bufMotion.startTimestamp = _start; + _bufMotion.endTimestamp = _end; + _bufMotion.requiredThreshold = _threshold; + _bufMotion.forVotes = _for; + _bufMotion.againstVotes = _against; + _bufMotion.abstainVotes = _abstain; + _bufMotion.executedAt = _excAt; + _bufMotion.executionResult = _excRes; + _bufMotion.executionReturnData = _excData; + + for (uint i; i < currentVoters.length; ++i) { + _bufMotion.receipts[currentVoters[i]] = + _governor.getReceipt(voteId, currentVoters[i]); + } + + return _bufMotion; + } + + //-------------------------------------------------------------------------- + // TESTS: INITIALIZATION + + function testInitWithInitialVoters(address[] memory testVoters) public { + //Checks that address list gets correctly stored on initialization + // We "reuse" the proposal created in the setup, but the proposal doesn't know about this new authorizer. + + vm.assume(testVoters.length >= 2); + _validateUserList(testVoters); + + address authImpl = address(new SingleVoteGovernor()); + SingleVoteGovernor testAuthorizer = + SingleVoteGovernor(Clones.clone(authImpl)); + + //Since the authorizer we are working with is not the default one, + // we must manually control that the fuzzer doesn't feed us its address + for (uint i; i < testVoters.length; ++i) { + vm.assume(testVoters[i] != address(testAuthorizer)); + } + + testAuthorizer.init( + IProposal(_proposal), + _METADATA, + abi.encode(testVoters, DEFAULT_QUORUM, DEFAULT_DURATION) + ); + + assertEq(address(testAuthorizer.proposal()), address(_proposal)); + + for (uint i; i < testVoters.length; ++i) { + assertEq(testAuthorizer.isVoter(testVoters[i]), true); + } + assertEq(testAuthorizer.isVoter(address(this)), false); + assertEq(testAuthorizer.voterCount(), testVoters.length); + } + + function testInitWithDuplicateInitialVotersFails( + address[] memory testVoters, + uint8 position + ) public { + //Checks that address list gets correctly stored on initialization + // We "reuse" the proposal created in the setup, but the proposal doesn't know about this new authorizer. + + vm.assume(testVoters.length >= 2); + position = uint8(bound(position, 1, testVoters.length - 1)); + + address authImpl = address(new SingleVoteGovernor()); + SingleVoteGovernor testAuthorizer = + SingleVoteGovernor(Clones.clone(authImpl)); + + _validateUserList(testVoters); + + //Since the authorizer we are working with is not the default one, + // we must manually control that the fuzzer doesn't feed us its address + for (uint i; i < testVoters.length; ++i) { + vm.assume(testVoters[i] != address(testAuthorizer)); + } + + testVoters[position] = testVoters[0]; + + vm.expectRevert( + abi.encodeWithSelector( + ISingleVoteGovernor + .Module__SingleVoteGovernor__IsAlreadyVoter + .selector + ) + ); + testAuthorizer.init( + IProposal(_proposal), + _METADATA, + abi.encode(testVoters, DEFAULT_QUORUM, DEFAULT_DURATION) + ); + } + + function testReinitFails() public { + //Create a mock new proposal + Proposal newProposal = Proposal(Clones.clone(address(new Proposal()))); + + address[] memory testVoters = new address[](1); + testVoters[0] = address(this); + + vm.expectRevert(); + _governor.init( + IProposal(newProposal), + _METADATA, + abi.encode( + testVoters, + DEFAULT_QUORUM, + DEFAULT_DURATION, + hasDependency, + dependencies + ) + ); + + assertEq(_authorizer.isAuthorized(address(_governor)), true); + assertEq(_governor.isVoter(ALBA), true); + assertEq(_governor.isVoter(BOB), true); + assertEq(_governor.isVoter(COBIE), true); + assertEq(_governor.voterCount(), 3); + } + + function testInitWithInvalidInitialVotersFails() public { + // We "reuse" the proposal created in the setup, but the proposal doesn't know about this new authorizer. + + address authImpl = address(new SingleVoteGovernor()); + SingleVoteGovernor testAuthorizer = + SingleVoteGovernor(Clones.clone(authImpl)); + + address[] memory testVoters; + vm.expectRevert( + abi.encodeWithSelector( + ISingleVoteGovernor + .Module__SingleVoteGovernor__EmptyVoters + .selector + ) + ); + testAuthorizer.init( + IProposal(_proposal), + _METADATA, + abi.encode(testVoters, DEFAULT_QUORUM, DEFAULT_DURATION) + ); + + //test faulty list (zero addresses) + testVoters = new address[](2); + + vm.expectRevert( + abi.encodeWithSelector( + ISingleVoteGovernor + .Module__SingleVoteGovernor__InvalidVoterAddress + .selector + ) + ); + testAuthorizer.init( + IProposal(_proposal), + _METADATA, + abi.encode(testVoters, DEFAULT_QUORUM, DEFAULT_DURATION) + ); + + testVoters[0] = address(testAuthorizer); + vm.expectRevert( + abi.encodeWithSelector( + ISingleVoteGovernor + .Module__SingleVoteGovernor__InvalidVoterAddress + .selector + ) + ); + testAuthorizer.init( + IProposal(_proposal), + _METADATA, + abi.encode(testVoters, DEFAULT_QUORUM, DEFAULT_DURATION) + ); + + testVoters[0] = address(_proposal); + vm.expectRevert( + abi.encodeWithSelector( + ISingleVoteGovernor + .Module__SingleVoteGovernor__InvalidVoterAddress + .selector + ) + ); + testAuthorizer.init( + IProposal(_proposal), + _METADATA, + abi.encode(testVoters, DEFAULT_QUORUM, DEFAULT_DURATION) + ); + + assertEq(address(testAuthorizer.proposal()), address(0)); + assertEq(testAuthorizer.voterCount(), 0); + } + + function testInit2SingleVoteGovernor() public { + // Attempting to call the init2 function with malformed data + // SHOULD FAIL + vm.expectRevert( + IModule.Module__NoDependencyOrMalformedDependencyData.selector + ); + _governor.init2(_proposal, abi.encode(123)); + + // Calling init2 for the first time with no dependency + // SHOULD FAIL + bytes memory dependencydata = abi.encode(hasDependency, dependencies); + vm.expectRevert( + IModule.Module__NoDependencyOrMalformedDependencyData.selector + ); + _governor.init2(_proposal, dependencydata); + + // Calling init2 for the first time with dependency = true + // SHOULD PASS + dependencydata = abi.encode(true, dependencies); + _governor.init2(_proposal, dependencydata); + + // Attempting to call the init2 function again. + // SHOULD FAIL + vm.expectRevert(IModule.Module__CannotCallInit2Again.selector); + _governor.init2(_proposal, dependencydata); + } + + //-------------------------------------------------------------------------- + // TESTS: VOTE CREATION + + // Create vote correctly + function testCreateVote() public { + (address _moduleAddress, bytes memory _msg) = getMockValidVote(); + + for (uint i; i < initialVoters.length; ++i) { + uint _voteID = createVote(ALBA, _moduleAddress, _msg); + + ISingleVoteGovernor.Motion storage _motion = + getFullMotionData(_voteID); + + assertEq(_governor.motionCount(), (_voteID + 1)); + assertEq(_motion.target, _moduleAddress); + assertEq(_motion.action, _msg); + assertEq(_motion.startTimestamp, block.timestamp); + assertEq(_motion.endTimestamp, (block.timestamp + DEFAULT_DURATION)); + assertEq(_motion.requiredThreshold, DEFAULT_QUORUM); + assertEq(_motion.forVotes, 0); + assertEq(_motion.againstVotes, 0); + assertEq(_motion.abstainVotes, 0); + assertEq(_motion.executedAt, 0); + assertEq(_motion.executionResult, false); + assertEq(_motion.executionReturnData, ""); + } + } + + // Fail to create a vote as non-voting address + function testUnauthorizedVoteCreation(address[] memory users) public { + _validateUserList(users); + + (address _moduleAddress, bytes memory _msg) = getMockValidVote(); + + for (uint i; i < users.length; ++i) { + assertEq(_governor.isVoter(users[i]), false); + vm.expectRevert( + ISingleVoteGovernor + .Module__SingleVoteGovernor__CallerNotVoter + .selector + ); + vm.prank(users[i]); + _governor.createMotion(_moduleAddress, _msg); + } + } + + function testUnauthorizedVoterAddition(address[] memory users) public { + _validateUserList(users); + batchAddAuthorized(users); + + for (uint i; i < users.length; ++i) { + vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); + vm.prank(users[i]); //authorized, but not Module + _governor.addVoter(users[i]); + } + } + + function testUnauthorizedVoterRemoval(address[] memory users) public { + _validateUserList(users); + batchAddAuthorized(users); + + for (uint i; i < users.length; ++i) { + vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); + vm.prank(users[i]); //authorized, but not Module + _governor.removeVoter(users[i]); + } + } + + // Add authorized address and have it create a vote + function testCreateVoteWithRecentlyAuthorizedAddress(address[] memory users) + public + { + _validateUserList(users); + + batchAddAuthorized(users); + + for (uint i; i < users.length; ++i) { + assertEq(_governor.isVoter(users[i]), true); + + //prank as that address, create a vote and vote on it + (address _moduleAddress, bytes memory _msg) = getMockValidVote(); + uint _newVote = createVote(users[i], _moduleAddress, _msg); + voteInFavor(users[i], _newVote); + + //assert that voting worked (also confirms that vote exists) + assertEq(_governor.getReceipt(_newVote, users[i]).hasVoted, true); + } + } + + //-------------------------------------------------------------------------- + // TESTS: VOTING + + // Vote in favor at the beginning and at the end of the period + function testVoteInFavor(address[] memory users) public { + _validateUserList(users); + batchAddAuthorized(users); + + //create a vote + (address _moduleAddress, bytes memory _msg) = getMockValidVote(); + uint _voteID = createVote(ALBA, _moduleAddress, _msg); + + ISingleVoteGovernor.Motion storage _motion = getFullMotionData(_voteID); + uint _votesBefore = _motion.forVotes; + + voteInFavor(ALBA, _voteID); + + uint startTime = block.timestamp; + + for (uint i; i < users.length; ++i) { + vm.warp(startTime + i); + voteInFavor(users[i], _voteID); + } + + //vote in the last possible moment + vm.warp(startTime + DEFAULT_DURATION); + voteInFavor(BOB, _voteID); + + _motion = getFullMotionData(_voteID); + + assertEq(_motion.receipts[ALBA].hasVoted, true); + assertEq(_motion.receipts[ALBA].support, 0); + + assertEq(_motion.receipts[BOB].hasVoted, true); + assertEq(_motion.receipts[BOB].support, 0); + + for (uint i; i < users.length; ++i) { + assertEq(_motion.receipts[users[i]].hasVoted, true); + assertEq(_motion.receipts[users[i]].support, 0); + } + + assertEq(_motion.forVotes, (_votesBefore + 2 + users.length)); + } + + // Fail to vote in favor as unauthorized address + function testVoteInFavorUnauthorized(address[] memory users) public { + _validateUserList(users); + + //create vote as authorized user + (address _moduleAddress, bytes memory _msg) = getMockValidVote(); + uint _voteID = createVote(ALBA, _moduleAddress, _msg); + + for (uint i; i < users.length; ++i) { + // fail to vote as unauthorized address + vm.expectRevert( + ISingleVoteGovernor + .Module__SingleVoteGovernor__CallerNotVoter + .selector + ); + voteInFavor(users[i], _voteID); + } + } + + // Vote against at the beginning and at the end of the period + function testVoteAgainst(address[] memory users) public { + _validateUserList(users); + batchAddAuthorized(users); + + //create a vote + (address _moduleAddress, bytes memory _msg) = getMockValidVote(); + uint _voteID = createVote(ALBA, _moduleAddress, _msg); + + ISingleVoteGovernor.Motion storage _motion = getFullMotionData(_voteID); + uint _votesBefore = _motion.againstVotes; + + voteAgainst(ALBA, _voteID); + + uint startTime = block.timestamp; + + for (uint i; i < users.length; ++i) { + vm.warp(startTime + i); + voteAgainst(users[i], _voteID); + } + + //vote in the last possible moment + vm.warp(startTime + DEFAULT_DURATION); + voteAgainst(BOB, _voteID); + + _motion = getFullMotionData(_voteID); + + assertEq(_motion.receipts[ALBA].hasVoted, true); + assertEq(_motion.receipts[ALBA].support, 1); + + assertEq(_motion.receipts[BOB].hasVoted, true); + assertEq(_motion.receipts[BOB].support, 1); + + for (uint i; i < users.length; ++i) { + assertEq(_motion.receipts[users[i]].hasVoted, true); + assertEq(_motion.receipts[users[i]].support, 1); + } + + assertEq(_motion.againstVotes, (_votesBefore + 2 + users.length)); + } + + // Fail to vote against as unauthorized address + function testVoteAgainstUnauthorized(address[] memory users) public { + _validateUserList(users); + //create vote + (address _moduleAddress, bytes memory _msg) = getMockValidVote(); + uint _voteID = createVote(ALBA, _moduleAddress, _msg); + + for (uint i; i < users.length; ++i) { + // fail to vote as unauthorized address + vm.expectRevert( + ISingleVoteGovernor + .Module__SingleVoteGovernor__CallerNotVoter + .selector + ); + voteAgainst(users[i], _voteID); + } + } + + // Vote abstain at the beginning and at the end of the period + function testAbstain(address[] memory users) public { + _validateUserList(users); + batchAddAuthorized(users); + + // create vote + (address _moduleAddress, bytes memory _msg) = getMockValidVote(); + uint _voteID = createVote(ALBA, _moduleAddress, _msg); + + ISingleVoteGovernor.Motion storage _motion = getFullMotionData(_voteID); + uint _votesBefore = _motion.abstainVotes; + + voteAbstain(ALBA, _voteID); + + uint startTime = block.timestamp; + + for (uint i; i < users.length; ++i) { + vm.warp(startTime + i); + voteAbstain(users[i], _voteID); + } + + //vote in the last possible moment + vm.warp(startTime + DEFAULT_DURATION); + voteAbstain(BOB, _voteID); + + ISingleVoteGovernor.Receipt memory _r = + _governor.getReceipt(_voteID, ALBA); + assertEq(_r.hasVoted, true); + assertEq(_r.support, 2); + + _r = _governor.getReceipt(_voteID, BOB); + assertEq(_r.hasVoted, true); + assertEq(_r.support, 2); + + for (uint i; i < users.length; ++i) { + _r = _governor.getReceipt(_voteID, users[i]); + assertEq(_r.hasVoted, true); + assertEq(_r.support, 2); + } + + _motion = getFullMotionData(_voteID); + + assertEq(_motion.receipts[ALBA].hasVoted, true); + assertEq(_motion.receipts[ALBA].support, 2); + + assertEq(_motion.receipts[BOB].hasVoted, true); + assertEq(_motion.receipts[BOB].support, 2); + + for (uint i; i < users.length; ++i) { + assertEq(_motion.receipts[users[i]].hasVoted, true); + assertEq(_motion.receipts[users[i]].support, 2); + } + + assertEq(_motion.abstainVotes, (_votesBefore + 2 + users.length)); + } + + // Fail to vote abstain as unauthorized address + function testAbstainUnauthorized(address[] memory users) public { + _validateUserList(users); + //create vote + (address _moduleAddress, bytes memory _msg) = getMockValidVote(); + uint _voteID = createVote(ALBA, _moduleAddress, _msg); + + for (uint i; i < users.length; ++i) { + // fail to vote as unauthorized address + vm.expectRevert( + ISingleVoteGovernor + .Module__SingleVoteGovernor__CallerNotVoter + .selector + ); + voteAbstain(users[i], _voteID); + } + } + + // Fail to vote after vote is closed (testing the three vote variants) + function testVoteOnExpired(uint[] memory nums) public { + //create vote + (address _moduleAddress, bytes memory _msg) = getMockValidVote(); + uint _voteID = createVote(ALBA, _moduleAddress, _msg); + + for (uint i; i < nums.length; ++i) { + nums[i] = bound(nums[i], 0, 100_000_000_000); + vm.warp(block.timestamp + DEFAULT_DURATION + 1 + nums[i]); + + // For + vm.expectRevert( + ISingleVoteGovernor + .Module__SingleVoteGovernor__MotionVotingPhaseClosed + .selector + ); + + voteInFavor(ALBA, _voteID); + + // Against + vm.expectRevert( + ISingleVoteGovernor + .Module__SingleVoteGovernor__MotionVotingPhaseClosed + .selector + ); + voteAgainst(ALBA, _voteID); + + //Abstain + vm.expectRevert( + ISingleVoteGovernor + .Module__SingleVoteGovernor__MotionVotingPhaseClosed + .selector + ); + voteAbstain(ALBA, _voteID); + } + } + + // Fail to vote on an unexisting voteID (testing the three vote variants) + function testVoteOnUnexistingID(uint160[] memory wrongIDs) public { + //create vote + (address _moduleAddress, bytes memory _msg) = getMockValidVote(); + uint _voteID = createVote(ALBA, _moduleAddress, _msg); + + for (uint i; i < wrongIDs.length; ++i) { + vm.assume(wrongIDs[i] > _voteID); + uint wrongID = wrongIDs[i]; + + // For + vm.expectRevert( + ISingleVoteGovernor + .Module__SingleVoteGovernor__InvalidMotionId + .selector + ); + + voteInFavor(ALBA, wrongID); + + // Against + vm.expectRevert( + ISingleVoteGovernor + .Module__SingleVoteGovernor__InvalidMotionId + .selector + ); + + voteAgainst(ALBA, wrongID); + + //Abstain + vm.expectRevert( + ISingleVoteGovernor + .Module__SingleVoteGovernor__InvalidMotionId + .selector + ); + voteAbstain(ALBA, wrongID); + } + } + + // Fail to vote with a different value than the allowed three + function testCastInvalidVote(uint8 wrongVote) public { + vm.assume(wrongVote > 2); + //create vote + (address _moduleAddress, bytes memory _msg) = getMockValidVote(); + uint _voteID = createVote(ALBA, _moduleAddress, _msg); + + vm.expectRevert( + ISingleVoteGovernor + .Module__SingleVoteGovernor__InvalidSupport + .selector + ); + vm.prank(ALBA); + _governor.castVote(_voteID, wrongVote); + } + + // Fail vote for after already voting (testing the three vote variants) + function testDoubleVoting(address[] memory users) public { + _validateUserList(users); + batchAddAuthorized(users); + //create vote + (address _moduleAddress, bytes memory _msg) = getMockValidVote(); + uint _voteID = createVote(ALBA, _moduleAddress, _msg); + + for (uint i; i < users.length; ++i) { + //vote once + voteAgainst(users[i], _voteID); + + vm.expectRevert( + ISingleVoteGovernor + .Module__SingleVoteGovernor__AttemptedDoubleVote + .selector + ); + voteInFavor(users[i], _voteID); + + vm.expectRevert( + ISingleVoteGovernor + .Module__SingleVoteGovernor__AttemptedDoubleVote + .selector + ); + voteAgainst(users[i], _voteID); + + vm.expectRevert( + ISingleVoteGovernor + .Module__SingleVoteGovernor__AttemptedDoubleVote + .selector + ); + voteAbstain(users[i], _voteID); + } + } + + //-------------------------------------------------------------------------- + // TEST: VOTE EXECUTION + + // Executing a vote that passed + function testVoteExecution() public { + // Here we will test a "standard" execution process to change the vote Duration. The process will be: + + // 1) Somebody creates a vote + uint _newDuration = 2 days; + bytes memory _encodedAction = + abi.encodeWithSignature("setVotingDuration(uint256)", _newDuration); + + // 2) The vote passes + uint _voteID = speedrunSuccessfulVote( + address(_governor), _encodedAction, initialVoters + ); + + // 3) The vote gets executed (by anybody) + _governor.executeMotion(_voteID); + + // 4) The module state has changed + assertEq(_governor.voteDuration(), _newDuration); + } + // Fail to execute vote that didn't pass + + function testExecuteInexistentVote(uint wrongId) public { + //No votes exist yet, everyting should fail + vm.expectRevert( + ISingleVoteGovernor + .Module__SingleVoteGovernor__InvalidMotionId + .selector + ); + _governor.executeMotion(wrongId); + } + + // Fail to execute vote that didn't pass + function testExecuteFailedVote() public { + (address _moduleAddress, bytes memory _encodedAction) = + getMockValidVote(); + + uint _voteID = speedrunRejectedVote( + address(_moduleAddress), _encodedAction, initialVoters + ); + + //No prank address needed + vm.expectRevert( + ISingleVoteGovernor + .Module__SingleVoteGovernor__ThresholdNotReached + .selector + ); + _governor.executeMotion(_voteID); + } + + //Fail to execute vote while voting is open + function testExecuteWhileVotingOpen() public { + // create vote + (address _moduleAddress, bytes memory _msg) = getMockValidVote(); + uint _voteID = createVote(ALBA, _moduleAddress, _msg); + + //First, we reach the threshold + voteInFavor(ALBA, _voteID); + voteInFavor(BOB, _voteID); + + vm.expectRevert( + abi.encodePacked( + ISingleVoteGovernor + .Module__SingleVoteGovernor__MotionInVotingPhase + .selector + ) + ); + _governor.executeMotion(_voteID); + + //we wait and try again in the last block of voting time + vm.warp(block.timestamp + _governor.voteDuration()); + + vm.expectRevert( + abi.encodePacked( + ISingleVoteGovernor + .Module__SingleVoteGovernor__MotionInVotingPhase + .selector + ) + ); + _governor.executeMotion(_voteID); + } + + // Fail to execute an already executed vote + function testDoubleExecution() public { + // 1) First we do a normal vote + execution + uint _newDuration = 3 days; + bytes memory _encodedAction = + abi.encodeWithSignature("setVotingDuration(uint256)", _newDuration); + + uint _voteID = speedrunSuccessfulVote( + address(_governor), _encodedAction, initialVoters + ); + + // 2) Then the vote gets executed by anybody + _governor.executeMotion(_voteID); + + // 3) the module state has changed + assertEq(_governor.voteDuration(), _newDuration); + + // 4) Now we test that we can't execute again: + vm.expectRevert( + abi.encodeWithSelector( + ISingleVoteGovernor + .Module__SingleVoteGovernor__MotionAlreadyExecuted + .selector + ) + ); + _governor.executeMotion(_voteID); + } + + function testOnlyGovernanceIsAuthorized(address _other) public { + vm.assume(_other != address(_governor)); + + vm.expectRevert(IProposal.Proposal__CallerNotAuthorized.selector); + vm.prank(_other); + _proposal.executeTx(address(0), ""); + } + + //-------------------------------------------------------------------------- + // TEST: VOTER MANAGEMENT + function testAddVoters(address[] memory users) public { + _validateUserList(users); + + vm.startPrank(address(_governor)); + for (uint i; i < users.length; ++i) { + _governor.addVoter(users[i]); + } + + for (uint i; i < users.length; ++i) { + assertEq(_governor.isVoter(users[i]), true); + } + //test idempotence. We do the same again and verify that nothing fails and everything stays the same. + for (uint i; i < users.length; ++i) { + _governor.addVoter(users[i]); + } + + for (uint i; i < users.length; ++i) { + assertEq(_governor.isVoter(users[i]), true); + } + + vm.stopPrank(); + } + + function testRemoveVoter(address[] memory users) public { + _validateUserList(users); + batchAddAuthorized(users); + + vm.startPrank(address(_governor)); + for (uint i; i < users.length; ++i) { + _governor.removeVoter(users[i]); + } + + for (uint i; i < users.length; ++i) { + assertEq(_governor.isVoter(users[i]), false); + } + //test idempotence. We do the same again and verify that nothing fails and everything stays the same. + for (uint i; i < users.length; ++i) { + _governor.removeVoter(users[i]); + } + + for (uint i; i < users.length; ++i) { + assertEq(_governor.isVoter(users[i]), false); + } + + vm.stopPrank(); + } + + // Fail to remove Authorized addresses until threshold is unreachble + function testRemoveTooManyVoters() public { + assertEq(address(_proposal), address(_governor.proposal())); + + vm.startPrank(address(_governor)); + _governor.removeVoter(COBIE); + + //this call would leave a 1 person list with a threshold of 2 + vm.expectRevert( + ISingleVoteGovernor + .Module__SingleVoteGovernor__UnreachableThreshold + .selector + ); + _governor.removeVoter(BOB); + + vm.stopPrank(); + } + + // Fail to remove Authorized addresses until the voterlist is empty + function testRemoveUntilVoterListEmpty() public { + assertEq(address(_proposal), address(_governor.proposal())); + + vm.startPrank(address(_governor)); + _governor.setThreshold(0); + + _governor.removeVoter(COBIE); + _governor.removeVoter(BOB); + + //this call would leave a 1 person list with a threshold of 2 + vm.expectRevert( + ISingleVoteGovernor.Module__SingleVoteGovernor__EmptyVoters.selector + ); + _governor.removeVoter(ALBA); + + vm.stopPrank(); + } + + //-------------------------------------------------------------------------- + // TEST: QUORUM + + // Get correct threshold + function testGetThreshold() public { + assertEq(_governor.threshold(), DEFAULT_QUORUM); + } + + // Set a new threshold + function testMotionSetThreshold() public { + uint _newQ = 1; + + vm.prank(address(_governor)); + _governor.setThreshold(_newQ); + + assertEq(_governor.threshold(), _newQ); + } + + // Fail to set a threshold that's too damn high + function testSetUnreachableThreshold(uint _newQ) public { + vm.assume(_newQ > _governor.voterCount()); + + vm.expectRevert( + ISingleVoteGovernor + .Module__SingleVoteGovernor__UnreachableThreshold + .selector + ); + vm.prank(address(_governor)); + _governor.setThreshold(_newQ); + } + + // Fail to change threshold when not the module itself + function testUnauthorizedThresholdChange(address[] memory users) public { + _validateUserList(users); + batchAddAuthorized(users); + + uint _newQ = 1; + for (uint i; i < users.length; ++i) { + vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); + vm.prank(users[i]); //authorized, but not Proposal + _governor.setThreshold(_newQ); + } + } + + //Change the threshold by going through governance + function testGovernanceThresholdChange() public { + uint _newThreshold = 1; + + // 1) Create and approve a vote + bytes memory _encodedAction = + abi.encodeWithSignature("setThreshold(uint256)", _newThreshold); + uint _voteID = speedrunSuccessfulVote( + address(_governor), _encodedAction, initialVoters + ); + + // 2) The vote gets executed by anybody + _governor.executeMotion(_voteID); + + // 3) The proposal state has changed + assertEq(_governor.threshold(), _newThreshold); + } + + //-------------------------------------------------------------------------- + // TEST: VOTE DURATION + + // Get correct vote duration + function testGetVoteDuration() public { + assertEq(_governor.voteDuration(), DEFAULT_DURATION); + } + + // Set new vote duration + function testMotionSetVoteDuration() public { + uint _newDur = 3 days; + + vm.prank(address(_governor)); + _governor.setVotingDuration(_newDur); + + assertEq(_governor.voteDuration(), _newDur); + } + + // Fail to set vote durations out of bounds + function testMotionSetInvalidVoteDuration() public { + uint _oldDur = _governor.voteDuration(); + uint _newDur = 3 weeks; + + vm.expectRevert( + abi.encodeWithSelector( + ISingleVoteGovernor + .Module__SingleVoteGovernor__InvalidVotingDuration + .selector + ) + ); + vm.prank(address(_governor)); + _governor.setVotingDuration(_newDur); + + _newDur = 1 hours; + + vm.expectRevert( + abi.encodeWithSelector( + ISingleVoteGovernor + .Module__SingleVoteGovernor__InvalidVotingDuration + .selector + ) + ); + vm.prank(address(_governor)); + _governor.setVotingDuration(_newDur); + + assertEq(_governor.voteDuration(), _oldDur); + } + + //Set new duration bygoing through governance + function testGovernanceVoteDurationChange() public { + //already covered in: + testVoteExecution(); + } + + // Fail to change vote duration when not the module itself + function testUnauthorizedGovernanceVoteDurationChange( + address[] memory users + ) public { + _validateUserList(users); + batchAddAuthorized(users); + + uint _newDuration = 5 days; + for (uint i; i < users.length; ++i) { + vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); + vm.prank(users[i]); //authorized, but not Proposal + _governor.setVotingDuration(_newDuration); + } + } + + // ========================================================================= + // Test Helper Functions + + function _validateUserList(address[] memory contribs) + internal + returns (address[] memory) + { + vm.assume(contribs.length != 0); + vm.assume(contribs.length < 40); + assumeValidUsers(contribs); + + return contribs; + } + // Adapted from proposal/helper/TypeSanityHelper.sol + + mapping(address => bool) userCache; + + function assumeValidUsers(address[] memory addrs) public { + for (uint i; i < addrs.length; ++i) { + assumeValidUser(addrs[i]); + + // Assume contributor address unique. + vm.assume(!userCache[addrs[i]]); + + // Add contributor address to cache. + userCache[addrs[i]] = true; + } + } + + function assumeValidUser(address a) public view { + address[] memory invalids = createInvalidUsers(); + + for (uint i; i < invalids.length; ++i) { + vm.assume(a != invalids[i]); + } + } + + function createInvalidUsers() public view returns (address[] memory) { + address[] memory invalids = new address[](10); + + invalids[0] = address(0); + invalids[1] = address(_proposal); + invalids[2] = address(_governor); + invalids[3] = address(_paymentProcessor); + invalids[4] = address(_token); + invalids[5] = address(module); + invalids[6] = address(this); + invalids[7] = ALBA; + invalids[8] = BOB; + invalids[9] = COBIE; + + return invalids; + } + // ========================================================================= +} diff --git a/test/modules/base/Module.t.sol b/test/modules/base/Module.t.sol index e1ea80f2c..37047f911 100644 --- a/test/modules/base/Module.t.sol +++ b/test/modules/base/Module.t.sol @@ -145,4 +145,25 @@ contract ModuleTest is Test { CONFIGDATA ); } + + //-------------------------------------------------------------------------- + // Access control tests + // TODO: write tests for the modifiers + + /* //note: if someone has a better idea to test this, it would be most welcome + function testOnlyRole(bool authorized) public { + if (!authorized) { + authorizer.setIsAuthorized(address(this), false); + //onlyBountyAdmin + vm.expectRevert( + abi.encodeWithSelector( + IModule.Module__CallerNotAuthorized.selector //, + //IBountyManager.Roles.BountyAdmin, + //address(bountyManager) + ) + ); + } + bountyManager.addBounty(1, 2, bytes("")); + } + */ } diff --git a/test/modules/logicModule/BountyManager.t.sol b/test/modules/logicModule/BountyManager.t.sol index 92148b07a..d8fbc1521 100644 --- a/test/modules/logicModule/BountyManager.t.sol +++ b/test/modules/logicModule/BountyManager.t.sol @@ -91,23 +91,6 @@ contract BountyManagerTest is ModuleTest { //-------------------------------------------------------------------------- // Modifier - //@todo Reminder that this will be moved into the ModuleTest Contract at a later point of time - //note: if someone has a better idea to test this, it would be most welcome - function testOnlyRole(bool authorized) public { - if (!authorized) { - _authorizer.setIsAuthorized(address(this), false); - //onlyBountyAdmin - vm.expectRevert( - abi.encodeWithSelector( - IModule.Module__CallerNotAuthorized.selector //, - //IBountyManager.Roles.BountyAdmin, - //address(bountyManager) - ) - ); - } - bountyManager.addBounty(1, 2, bytes("")); - } - function testOnlyClaimContributor( address[] memory addrs, uint[] memory amounts, diff --git a/test/utils/mocks/modules/AuthorizerMock.sol b/test/utils/mocks/modules/AuthorizerMock.sol index 1e140fdb2..a8de22662 100644 --- a/test/utils/mocks/modules/AuthorizerMock.sol +++ b/test/utils/mocks/modules/AuthorizerMock.sol @@ -56,8 +56,10 @@ contract AuthorizerMock is IAuthorizer, Module { //-------------------------------------------------------------------------- // IAuthorizer Functions + // Also accepts the owner role as authorized. function isAuthorized(address who) external view returns (bool) { - return _authorized[who] || _allAuthorized; + return _authorized[who] || _allAuthorized + || _roleAuthorized[generateRoleId(address(proposal()), uint8(0))][who]; } //IRoleAuthorizer From b68c137bf6546d2a177e63afcb0b625e4bec546c Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Wed, 2 Aug 2023 11:59:03 +0200 Subject: [PATCH 06/32] fix some todos --- src/modules/authorizer/RoleAuthorizer.sol | 19 ++++++++++++++++++- src/modules/base/Module.sol | 2 +- src/modules/logicModule/BountyManager.sol | 6 ------ test/modules/authorizer/RoleAuthorizer.t.sol | 3 +++ test/modules/logicModule/BountyManager.t.sol | 5 ++--- test/proposal/Proposal.t.sol | 17 ----------------- 6 files changed, 24 insertions(+), 28 deletions(-) diff --git a/src/modules/authorizer/RoleAuthorizer.sol b/src/modules/authorizer/RoleAuthorizer.sol index 87c3b2c62..7fd8e6fe8 100644 --- a/src/modules/authorizer/RoleAuthorizer.sol +++ b/src/modules/authorizer/RoleAuthorizer.sol @@ -18,7 +18,6 @@ contract RoleAuthorizer is // Core roles for a proposal. They correspond to uint8(0) and uint(1) // NOTE that proposal owner can register more global roles using numbers from 2 onward. They'l need to go through the DEFAULT_ADMIN_ROLE for this. - // TODO Maybe it would be worth it to create an extra function that bypasses DEFAULT_ADMIN_ROLE, but only for global roles and by the PROPOSAL_OWNER_ROLE? This would streamline the process of creating roles for all modules enum CoreRoles { OWNER, // Partial Access to Protected Functions MANAGER // Full Access to Protected Functions @@ -232,6 +231,24 @@ contract RoleAuthorizer is _setRoleAdmin(roleId, BURN_ADMIN_ROLE); } + //TODO: Add to interface and natspec + + function grantGlobalRole(uint8 role, address target) + external + onlyRole(PROPOSAL_OWNER_ROLE) + { + bytes32 roleId = generateRoleId(address(proposal()), role); + _grantRole(roleId, target); + } + + function revokeGlobalRole(uint8 role, address target) + external + onlyRole(PROPOSAL_OWNER_ROLE) + { + bytes32 roleId = generateRoleId(address(proposal()), role); + _revokeRole(roleId, target); + } + function getOwnerRole() public view returns (bytes32) { return PROPOSAL_OWNER_ROLE; } diff --git a/src/modules/base/Module.sol b/src/modules/base/Module.sol index 8105a966a..9846d14f1 100644 --- a/src/modules/base/Module.sol +++ b/src/modules/base/Module.sol @@ -91,7 +91,7 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { _; } - //@todo Reminder that this will be moved into the Module Contract at a later point of time + /// @notice Modifier to guarantee function is only callable by addresses that hold a specific module-assigned role. modifier onlyModuleRole(uint8 roleId) { if ( !IAuthorizer(address(__Module_proposal.authorizer())).isAuthorized( diff --git a/src/modules/logicModule/BountyManager.sol b/src/modules/logicModule/BountyManager.sol index d10fe362f..246c5cadf 100644 --- a/src/modules/logicModule/BountyManager.sol +++ b/src/modules/logicModule/BountyManager.sol @@ -26,12 +26,6 @@ import { // Internal Libraries import {LinkedIdList} from "src/common/LinkedIdList.sol"; -//@todo this has a direct dependency to the new RoleAuthorizer Module. -//At the current state of the project the IRoleAuthorizer isnt the standardized Interface to use, -//That means there is a possibility function calls will fail if the roleAuthorizer isnt implemented as the Authorizer -//This will be changed in the coming future, -//but till then the RoleAuthorizer has to be selected as the Authorizer Module of the proposal if the BountyManager is to be used - contract BountyManager is IBountyManager, Module, PaymentClient { using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.UintSet; diff --git a/test/modules/authorizer/RoleAuthorizer.t.sol b/test/modules/authorizer/RoleAuthorizer.t.sol index ebba4c02b..e4adedb26 100644 --- a/test/modules/authorizer/RoleAuthorizer.t.sol +++ b/test/modules/authorizer/RoleAuthorizer.t.sol @@ -619,6 +619,9 @@ contract RoleAuthorizerTest is Test { ); } + // Test grant and revoke global roles + // TODO + // ========================================================================= // Test granting and revoking ADMIN control, and test admin control over module roles diff --git a/test/modules/logicModule/BountyManager.t.sol b/test/modules/logicModule/BountyManager.t.sol index d8fbc1521..b9439e62e 100644 --- a/test/modules/logicModule/BountyManager.t.sol +++ b/test/modules/logicModule/BountyManager.t.sol @@ -783,8 +783,7 @@ contract BountyManagerTest is ModuleTest { //-------------------------------------------------------------------------- // Role Functions - //@todo trivial to be removed as soon as the functionality is moved to RoleAuthorizer - function testGrantBountyAdminRole(uint8 role, address addr) public { + function testGrantModuleRole(uint8 role, address addr) public { vm.assume(role <= uint8(type(IBountyManager.Roles).max)); bountyManager.grantModuleRole(role, addr); @@ -793,7 +792,7 @@ contract BountyManagerTest is ModuleTest { assertTrue(isAuthorized); } - function testRevokeBountyAdminRole(uint8 role, address addr) public { + function testRevokeModuleRole(uint8 role, address addr) public { vm.assume(role <= uint8(type(IBountyManager.Roles).max)); bountyManager.grantModuleRole(role, addr); diff --git a/test/proposal/Proposal.t.sol b/test/proposal/Proposal.t.sol index 190e2ea03..a3c8053e4 100644 --- a/test/proposal/Proposal.t.sol +++ b/test/proposal/Proposal.t.sol @@ -84,7 +84,6 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - //address(this), token, truncatedModules, fundingManager, @@ -98,7 +97,6 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - //address(this), token, modules, fundingManager, @@ -109,8 +107,6 @@ contract ProposalTest is Test { // Check that proposal's storage correctly initialized. assertEq(proposal.proposalId(), proposalId); - //bytes32 managerRole = proposal.authorizer().getManagerRole(); TODO - //assertTrue(proposal.authorizer().hasRole(managerRole, address(this))); assertEq(address(proposal.token()), address(token)); assertEq(address(proposal.authorizer()), address(authorizer)); assertEq( @@ -136,7 +132,6 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - //address(this), token, truncatedModules, fundingManager, @@ -147,7 +142,6 @@ contract ProposalTest is Test { vm.expectRevert(OZErrors.Initializable__AlreadyInitialized); proposal.init( proposalId, - //address(this), token, truncatedModules, fundingManager, @@ -162,7 +156,6 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - //address(this), token, modules, fundingManager, @@ -173,7 +166,6 @@ contract ProposalTest is Test { vm.expectRevert(OZErrors.Initializable__AlreadyInitialized); proposal.init( proposalId, - // address(this), token, modules, fundingManager, @@ -202,7 +194,6 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - // address(this), token, modules, fundingManager, @@ -251,7 +242,6 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - // address(this), token, modules, fundingManager, @@ -293,7 +283,6 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - // address(this), token, modules, fundingManager, @@ -336,7 +325,6 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - // address(this), token, truncatedModules, fundingManager, @@ -352,7 +340,6 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - //address(this), token, modules, fundingManager, @@ -386,7 +373,6 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - //address(this), token, truncatedModules, fundingManager, @@ -402,7 +388,6 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - //address(this), token, modules, fundingManager, @@ -437,7 +422,6 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - //address(0xCAFE), // Note to not be the owner -> change in authmetadata? token, truncatedModules, fundingManager, @@ -453,7 +437,6 @@ contract ProposalTest is Test { // Initialize proposal. proposal.init( proposalId, - //address(0xCAFE), // Note to not be the owner -> change in auth metadata? token, modules, fundingManager, From 4f600b8b97dd3c044094d76acce3300cfdba664b Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Wed, 2 Aug 2023 13:41:22 +0200 Subject: [PATCH 07/32] more merge fixes --- src/modules/MetadataManager.sol | 6 ++-- src/modules/authorizer/RoleAuthorizer.sol | 18 ++++++------ src/modules/base/Module.sol | 13 ++++----- src/modules/logicModule/BountyManager.sol | 4 +-- src/modules/logicModule/MilestoneManager.sol | 18 ++++++------ .../logicModule/RecurringPaymentManager.sol | 4 +-- .../StreamingPaymentProcessor.sol | 4 +-- src/orchestrator/Orchestrator.sol | 12 ++++---- .../authorizer/SingleVoteGovernor.t.sol | 24 ++++++++++------ .../authorizer/TokenGatedRoleAuthorizer.t.sol | 1 - .../logicModule/MilestoneManager.t.sol | 28 ++++++++++++++----- test/utils/mocks/modules/AuthorizerMock.sol | 15 +++++----- 12 files changed, 83 insertions(+), 64 deletions(-) diff --git a/src/modules/MetadataManager.sol b/src/modules/MetadataManager.sol index e7138a0d3..b37c4c18d 100644 --- a/src/modules/MetadataManager.sol +++ b/src/modules/MetadataManager.sol @@ -75,7 +75,7 @@ contract MetadataManager is IMetadataManager, Module { function setManagerMetadata(ManagerMetadata calldata managerMetadata_) external - onlyProposalOwnerOrManager + onlyOrchestratorOwnerOrManager { _setManagerMetadata(managerMetadata_); } @@ -93,7 +93,7 @@ contract MetadataManager is IMetadataManager, Module { function setOrchestratorMetadata( OrchestratorMetadata calldata orchestratorMetadata_ - ) public onlyAuthorizedOrManager { + ) public onlyOrchestratorOwnerOrManager { _setOrchestratorMetadata(orchestratorMetadata_); } @@ -112,7 +112,7 @@ contract MetadataManager is IMetadataManager, Module { function setTeamMetadata(MemberMetadata[] calldata teamMetadata_) external - onlyProposalOwnerOrManager + onlyOrchestratorOwnerOrManager { _setTeamMetadata(teamMetadata_); } diff --git a/src/modules/authorizer/RoleAuthorizer.sol b/src/modules/authorizer/RoleAuthorizer.sol index 25133d738..77e9746b8 100644 --- a/src/modules/authorizer/RoleAuthorizer.sol +++ b/src/modules/authorizer/RoleAuthorizer.sol @@ -16,8 +16,8 @@ contract RoleAuthorizer is //-------------------------------------------------------------------------- // Storage - // Core roles for a proposal. They correspond to uint8(0) and uint(1) - // NOTE that proposal owner can register more global roles using numbers from 2 onward. They'l need to go through the DEFAULT_ADMIN_ROLE for this. + // Core roles for a orchestrator. They correspond to uint8(0) and uint(1) + // NOTE that orchestrator owner can register more global roles using numbers from 2 onward. They'l need to go through the DEFAULT_ADMIN_ROLE for this. enum CoreRoles { OWNER, // Partial Access to Protected Functions MANAGER // Full Access to Protected Functions @@ -101,7 +101,7 @@ contract RoleAuthorizer is generateRoleId(address(orchestrator()), uint8(CoreRoles.MANAGER)); //We preliminarily grant admin role to the deployer - _grantRole(PROPOSAL_OWNER_ROLE, _msgSender()); + _grantRole(ORCHESTRATOR_OWNER_ROLE, _msgSender()); // Set up OWNER role structure: @@ -235,25 +235,25 @@ contract RoleAuthorizer is function grantGlobalRole(uint8 role, address target) external - onlyRole(PROPOSAL_OWNER_ROLE) + onlyRole(ORCHESTRATOR_OWNER_ROLE) { - bytes32 roleId = generateRoleId(address(proposal()), role); + bytes32 roleId = generateRoleId(address(orchestrator()), role); _grantRole(roleId, target); } function revokeGlobalRole(uint8 role, address target) external - onlyRole(PROPOSAL_OWNER_ROLE) + onlyRole(ORCHESTRATOR_OWNER_ROLE) { - bytes32 roleId = generateRoleId(address(proposal()), role); + bytes32 roleId = generateRoleId(address(orchestrator()), role); _revokeRole(roleId, target); } function getOwnerRole() public view returns (bytes32) { - return PROPOSAL_OWNER_ROLE; + return ORCHESTRATOR_OWNER_ROLE; } function getManagerRole() public view returns (bytes32) { - return PROPOSAL_MANAGER_ROLE; + return ORCHESTRATOR_MANAGER_ROLE; } } diff --git a/src/modules/base/Module.sol b/src/modules/base/Module.sol index 7b0d492a9..e7f941953 100644 --- a/src/modules/base/Module.sol +++ b/src/modules/base/Module.sol @@ -94,9 +94,8 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { /// @notice Modifier to guarantee function is only callable by addresses that hold a specific module-assigned role. modifier onlyModuleRole(uint8 roleId) { if ( - !IAuthorizer(address(__Module_orchestrator.authorizer())).isAuthorized( - roleId, _msgSender() - ) + !IAuthorizer(address(__Module_orchestrator.authorizer())) + .isAuthorized(roleId, _msgSender()) ) { //revert Module__BountyManager__OnlyRole(roleId, address(this)); revert Module__CallerNotAuthorized(); @@ -207,19 +206,19 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { function grantModuleRole(uint8 role, address addr) external - onlyProposalOwner + onlyOrchestratorOwner { IAuthorizer roleAuthorizer = - IAuthorizer(address(__Module_proposal.authorizer())); + IAuthorizer(address(__Module_orchestrator.authorizer())); roleAuthorizer.grantRoleFromModule(uint8(role), addr); } function revokeModuleRole(uint8 role, address addr) external - onlyProposalOwner + onlyOrchestratorOwner { IAuthorizer roleAuthorizer = - IAuthorizer(address(__Module_proposal.authorizer())); + IAuthorizer(address(__Module_orchestrator.authorizer())); roleAuthorizer.revokeRoleFromModule(uint8(role), addr); } diff --git a/src/modules/logicModule/BountyManager.sol b/src/modules/logicModule/BountyManager.sol index d078beea2..c33aa07fa 100644 --- a/src/modules/logicModule/BountyManager.sol +++ b/src/modules/logicModule/BountyManager.sol @@ -192,8 +192,8 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { { //Note: due to the authorizer still not being set during initialization, // this function has to be called after. - IAuthorizer(address(orchestrator().authorizer())).toggleModuleSelfManagement( - ); + IAuthorizer(address(orchestrator().authorizer())) + .toggleModuleSelfManagement(); } //-------------------------------------------------------------------------- diff --git a/src/modules/logicModule/MilestoneManager.sol b/src/modules/logicModule/MilestoneManager.sol index 3f70a42d7..d8cab95ef 100644 --- a/src/modules/logicModule/MilestoneManager.sol +++ b/src/modules/logicModule/MilestoneManager.sol @@ -345,7 +345,7 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { uint budget, Contributor[] calldata contributors, bytes calldata details - ) external onlyProposalOwnerOrManager returns (uint) { + ) external onlyOrchestratorOwnerOrManager returns (uint) { _validateMilestoneDetails(duration, budget, contributors, details); return _addMilestone(duration, budget, contributors, details); @@ -354,7 +354,7 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { /// @inheritdoc IMilestoneManager function stopMilestone(uint prevId, uint id) external - onlyProposalOwnerOrManager + onlyOrchestratorOwnerOrManager validId(id) { Milestone storage m = _milestoneRegistry[id]; @@ -385,7 +385,7 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { /// @inheritdoc IMilestoneManager function removeMilestone(uint prevId, uint id) external - onlyProposalOwnerOrManager + onlyOrchestratorOwnerOrManager validId(id) { Milestone storage m = _milestoneRegistry[id]; @@ -406,7 +406,7 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { } /// @inheritdoc IMilestoneManager - function startNextMilestone() external onlyProposalOwnerOrManager { + function startNextMilestone() external onlyOrchestratorOwnerOrManager { if (!isNextMilestoneActivatable()) { revert Module__MilestoneManager__MilestoneNotActivateable(); } @@ -481,7 +481,7 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { uint budget, Contributor[] calldata contributors, bytes calldata details - ) external onlyProposalOwnerOrManager validId(id) { + ) external onlyOrchestratorOwnerOrManager validId(id) { _validateMilestoneDetails(duration, budget, contributors, details); Milestone storage m = _milestoneRegistry[id]; @@ -530,7 +530,7 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { /// @inheritdoc IMilestoneManager function moveMilestoneInList(uint id, uint prevId, uint idToPositionAfter) external - onlyProposalOwnerOrManager + onlyOrchestratorOwnerOrManager validMilestonePositionShift(id, idToPositionAfter) { _milestoneList.moveIdInList(id, prevId, idToPositionAfter); @@ -559,7 +559,7 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { /// @inheritdoc IMilestoneManager function completeMilestone(uint milestoneId) external - onlyProposalOwnerOrManager + onlyOrchestratorOwnerOrManager validId(milestoneId) { Milestone storage m = _milestoneRegistry[milestoneId]; @@ -578,7 +578,7 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { /// @inheritdoc IMilestoneManager function declineMilestone(uint milestoneId) external - onlyProposalOwnerOrManager + onlyOrchestratorOwnerOrManager validId(milestoneId) { Milestone storage m = _milestoneRegistry[milestoneId]; @@ -683,7 +683,7 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { function updateMilestoneUpdateTimelock(uint _newTimelock) external - onlyProposalOwner + onlyOrchestratorOwner { _milestoneUpdateTimelock = _newTimelock; emit MilestoneUpdateTimelockUpdated(_milestoneUpdateTimelock); diff --git a/src/modules/logicModule/RecurringPaymentManager.sol b/src/modules/logicModule/RecurringPaymentManager.sol index 3f10185f9..1a46cbd84 100644 --- a/src/modules/logicModule/RecurringPaymentManager.sol +++ b/src/modules/logicModule/RecurringPaymentManager.sol @@ -169,7 +169,7 @@ contract RecurringPaymentManager is address recipient ) external - onlyProposalOwnerOrManager + onlyOrchestratorOwnerOrManager validAmount(amount) validStartEpoch(startEpoch) validRecipient(recipient) @@ -203,7 +203,7 @@ contract RecurringPaymentManager is /// @inheritdoc IRecurringPaymentManager function removeRecurringPayment(uint prevId, uint id) external - onlyProposalOwnerOrManager + onlyOrchestratorOwnerOrManager { //trigger to resolve all due Payments _triggerFor(id, id); diff --git a/src/modules/paymentProcessor/StreamingPaymentProcessor.sol b/src/modules/paymentProcessor/StreamingPaymentProcessor.sol index 02f1ffb2d..0f27f6c22 100644 --- a/src/modules/paymentProcessor/StreamingPaymentProcessor.sol +++ b/src/modules/paymentProcessor/StreamingPaymentProcessor.sol @@ -208,7 +208,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { function removeAllPaymentReceiverPayments( IERC20PaymentClient client, address paymentReceiver - ) external onlyProposalOwner { + ) external onlyOrchestratorOwner { if ( _findAddressInActiveVestings(address(client), paymentReceiver) == type(uint).max @@ -226,7 +226,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { address paymentReceiver, uint walletId, bool retryForUnclaimableAmounts - ) external onlyProposalOwner { + ) external onlyOrchestratorOwner { // First, we give the vested funds from this specific walletId to the beneficiary _claimForSpecificWalletId( address(client), diff --git a/src/orchestrator/Orchestrator.sol b/src/orchestrator/Orchestrator.sol index d4aa114f1..259e96659 100644 --- a/src/orchestrator/Orchestrator.sol +++ b/src/orchestrator/Orchestrator.sol @@ -46,7 +46,7 @@ contract Orchestrator is IOrchestrator, ModuleManager { /// @notice Modifier to guarantee function is only callable by authorized /// address. - modifier onlyProposalOwner() { + modifier onlyOrchestratorOwner() { if (!authorizer.isAuthorized(_msgSender())) { revert Orchestrator__CallerNotAuthorized(); } @@ -277,9 +277,9 @@ contract Orchestrator is IOrchestrator, ModuleManager { } //-------------------------------------------------------------------------- - // onlyProposalOwner Functions + // onlyOrchestratorOwner Functions - /// @inheritdoc IProposal + /// @inheritdoc IOrchestrator function setAuthorizer(IAuthorizer authorizer_) external onlyOrchestratorOwner @@ -293,7 +293,7 @@ contract Orchestrator is IOrchestrator, ModuleManager { /// @inheritdoc IOrchestrator function setFundingManager(IFundingManager fundingManager_) external - onlyProposalOwner + onlyOrchestratorOwner { addModule(address(fundingManager_)); removeModule(address(fundingManager)); @@ -304,7 +304,7 @@ contract Orchestrator is IOrchestrator, ModuleManager { /// @inheritdoc IOrchestrator function setPaymentProcessor(IPaymentProcessor paymentProcessor_) external - onlyProposalOwner + onlyOrchestratorOwner { addModule(address(paymentProcessor_)); removeModule(address(paymentProcessor)); @@ -315,7 +315,7 @@ contract Orchestrator is IOrchestrator, ModuleManager { /// @inheritdoc IOrchestrator function executeTx(address target, bytes memory data) external - onlyProposalOwner + onlyOrchestratorOwner returns (bytes memory) { bool ok; diff --git a/test/modules/authorizer/SingleVoteGovernor.t.sol b/test/modules/authorizer/SingleVoteGovernor.t.sol index 39b97ec4b..d23381989 100644 --- a/test/modules/authorizer/SingleVoteGovernor.t.sol +++ b/test/modules/authorizer/SingleVoteGovernor.t.sol @@ -2,6 +2,7 @@ pragma solidity ^0.8.0; import {Test} from "forge-std/Test.sol"; +import "forge-std/console.sol"; // SuT import { @@ -101,14 +102,21 @@ contract SingleVoteGovernorTest is Test { uint _startingThreshold = DEFAULT_QUORUM; uint _startingDuration = DEFAULT_DURATION; - _authorizer.init( + _governor.init( IOrchestrator(_orchestrator), _METADATA, abi.encode(initialVoters, _startingThreshold, _startingDuration) ); + _authorizer.init2(_orchestrator, dependencyData); + + + + console.log(address(_authorizer.orchestrator())); + console.log(address(_orchestrator)); + assertEq(address(_authorizer.orchestrator()), address(_orchestrator)); - assertEq(_proposal.isModule(address(_governor)), true); + assertEq(_orchestrator.isModule(address(_governor)), true); assertEq(_authorizer.isAuthorized(address(_governor)), true); assertEq(_governor.isVoter(ALBA), true); @@ -122,8 +130,8 @@ contract SingleVoteGovernorTest is Test { // The deployer may be owner, but not authorized by default assertEq(_authorizer.isAuthorized(address(this)), false); assertEq(_authorizer.isAuthorized(address(_orchestrator)), false); - assertEq(_authorizer.isVoter(address(this)), false); - assertEq(_authorizer.isVoter(address(_orchestrator)), false); + assertEq(_governor.isVoter(address(this)), false); + assertEq(_governor.isVoter(address(_orchestrator)), false); assertEq(_governor.voterCount(), 3); } @@ -454,7 +462,7 @@ contract SingleVoteGovernorTest is Test { // Attempting to call the init2 function again. // SHOULD FAIL vm.expectRevert(IModule.Module__CannotCallInit2Again.selector); - _governor.init2(_orchestrator, dependencydata); + _governor.init2(_orchestrator, dependencyData); } //-------------------------------------------------------------------------- @@ -1116,7 +1124,7 @@ contract SingleVoteGovernorTest is Test { uint _newQ = 1; for (uint i; i < users.length; ++i) { vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); - vm.prank(users[i]); //authorized, but not Proposal + vm.prank(users[i]); //authorized, but not orchestrator _governor.setThreshold(_newQ); } } @@ -1135,7 +1143,7 @@ contract SingleVoteGovernorTest is Test { // 2) The vote gets executed by anybody _governor.executeMotion(_voteID); - // 3) The proposal state has changed + // 3) The orchestrator state has changed assertEq(_governor.threshold(), _newThreshold); } @@ -1203,7 +1211,7 @@ contract SingleVoteGovernorTest is Test { uint _newDuration = 5 days; for (uint i; i < users.length; ++i) { vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); - vm.prank(users[i]); //authorized, but not Proposal + vm.prank(users[i]); //authorized, but not orchestrator _governor.setVotingDuration(_newDuration); } } diff --git a/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol b/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol index 648a48736..29cdc0086 100644 --- a/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol +++ b/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol @@ -47,7 +47,6 @@ contract TokenGatedRoleAuthorizerUpstreamTests is RoleAuthorizerTest { modules[0] = address(module); _orchestrator.init( _ORCHESTRATOR_ID, - _token, modules, _fundingManager, diff --git a/test/modules/logicModule/MilestoneManager.t.sol b/test/modules/logicModule/MilestoneManager.t.sol index 7c00aed56..104a86a43 100644 --- a/test/modules/logicModule/MilestoneManager.t.sol +++ b/test/modules/logicModule/MilestoneManager.t.sol @@ -476,7 +476,9 @@ contract MilestoneManagerTest is ModuleTest { { _authorizer.setIsAuthorized(caller, false); bytes32 managerRole = _orchestrator.authorizer().getManagerRole(); - vm.assume(!_orchestrator.authorizer().hasRole(managerRole, address(caller))); + vm.assume( + !_orchestrator.authorizer().hasRole(managerRole, address(caller)) + ); vm.prank(caller); vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); @@ -657,7 +659,9 @@ contract MilestoneManagerTest is ModuleTest { _authorizer.setIsAuthorized(caller, false); bytes32 managerRole = _orchestrator.authorizer().getManagerRole(); - vm.assume(!_orchestrator.authorizer().hasRole(managerRole, address(caller))); + vm.assume( + !_orchestrator.authorizer().hasRole(managerRole, address(caller)) + ); vm.prank(caller); vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); @@ -831,7 +835,9 @@ contract MilestoneManagerTest is ModuleTest { ) public { _authorizer.setIsAuthorized(caller, false); bytes32 managerRole = _orchestrator.authorizer().getManagerRole(); - vm.assume(!_orchestrator.authorizer().hasRole(managerRole, address(caller))); + vm.assume( + !_orchestrator.authorizer().hasRole(managerRole, address(caller)) + ); vm.prank(caller); vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); @@ -951,7 +957,9 @@ contract MilestoneManagerTest is ModuleTest { ) public { _authorizer.setIsAuthorized(caller, false); bytes32 managerRole = _orchestrator.authorizer().getManagerRole(); - vm.assume(!_orchestrator.authorizer().hasRole(managerRole, address(caller))); + vm.assume( + !_orchestrator.authorizer().hasRole(managerRole, address(caller)) + ); milestoneManager.addMilestone( DURATION, BUDGET, DEFAULT_CONTRIBUTORS, DETAILS @@ -1101,7 +1109,9 @@ contract MilestoneManagerTest is ModuleTest { ) public { _authorizer.setIsAuthorized(caller, false); bytes32 managerRole = _orchestrator.authorizer().getManagerRole(); - vm.assume(!_orchestrator.authorizer().hasRole(managerRole, address(caller))); + vm.assume( + !_orchestrator.authorizer().hasRole(managerRole, address(caller)) + ); uint id = milestoneManager.addMilestone( DURATION, BUDGET, DEFAULT_CONTRIBUTORS, DETAILS @@ -1575,7 +1585,9 @@ contract MilestoneManagerTest is ModuleTest { ) public { _authorizer.setIsAuthorized(caller, false); bytes32 managerRole = _orchestrator.authorizer().getManagerRole(); - vm.assume(!_orchestrator.authorizer().hasRole(managerRole, address(caller))); + vm.assume( + !_orchestrator.authorizer().hasRole(managerRole, address(caller)) + ); IMilestoneManager.Contributor[] memory contribs = _generateEqualContributors(contributors); @@ -1699,7 +1711,9 @@ contract MilestoneManagerTest is ModuleTest { ) public { _authorizer.setIsAuthorized(caller, false); bytes32 managerRole = _orchestrator.authorizer().getManagerRole(); - vm.assume(!_orchestrator.authorizer().hasRole(managerRole, address(caller))); + vm.assume( + !_orchestrator.authorizer().hasRole(managerRole, address(caller)) + ); IMilestoneManager.Contributor[] memory contribs = _generateEqualContributors(contributors); diff --git a/test/utils/mocks/modules/AuthorizerMock.sol b/test/utils/mocks/modules/AuthorizerMock.sol index ac10ca44e..235f3ad5f 100644 --- a/test/utils/mocks/modules/AuthorizerMock.sol +++ b/test/utils/mocks/modules/AuthorizerMock.sol @@ -35,12 +35,11 @@ contract AuthorizerMock is IAuthorizer, Module { _authorized[authorized] = true; - _roleAuthorized[generateRoleId(address(proposal()), uint8(0))][msg + _roleAuthorized[generateRoleId(address(orchestrator()), uint8(0))][msg .sender] = true; - _roleAuthorized[generateRoleId(address(proposal()), uint8(1))][msg + _roleAuthorized[generateRoleId(address(orchestrator()), uint8(1))][msg .sender] = true; - console.log(msg.sender); } function mockInit(bytes memory configData) public { @@ -57,7 +56,7 @@ contract AuthorizerMock is IAuthorizer, Module { // Also accepts the owner role as authorized. function isAuthorized(address who) external view returns (bool) { return _authorized[who] || _allAuthorized - || _roleAuthorized[generateRoleId(address(proposal()), uint8(0))][who]; + || _roleAuthorized[generateRoleId(address(orchestrator()), uint8(0))][who]; } //IRoleAuthorizer @@ -69,8 +68,8 @@ contract AuthorizerMock is IAuthorizer, Module { { return _authorized[who] || _roleAuthorized[generateRoleId(msg.sender, role)][who] - || _roleAuthorized[generateRoleId(address(proposal()), uint8(0))][who] - || _roleAuthorized[generateRoleId(address(proposal()), uint8(1))][who] + || _roleAuthorized[generateRoleId(address(orchestrator()), uint8(0))][who] + || _roleAuthorized[generateRoleId(address(orchestrator()), uint8(1))][who] || _allAuthorized; } @@ -123,10 +122,10 @@ contract AuthorizerMock is IAuthorizer, Module { function renounceRole(bytes32, address) external pure {} function getOwnerRole() external view returns (bytes32) { - return generateRoleId(address(proposal()), uint8(0)); + return generateRoleId(address(orchestrator()), uint8(0)); } function getManagerRole() external view returns (bytes32) { - return generateRoleId(address(proposal()), uint8(1)); + return generateRoleId(address(orchestrator()), uint8(1)); } } From e0580a552d7cd8f86cefb5df34c8f0ebb1425a74 Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Wed, 2 Aug 2023 14:20:27 +0200 Subject: [PATCH 08/32] fix singlevotegovernor tests --- .../authorizer/SingleVoteGovernor.t.sol | 88 ++++++------------- test/utils/mocks/modules/AuthorizerMock.sol | 1 - 2 files changed, 26 insertions(+), 63 deletions(-) diff --git a/test/modules/authorizer/SingleVoteGovernor.t.sol b/test/modules/authorizer/SingleVoteGovernor.t.sol index d23381989..6a284ec4c 100644 --- a/test/modules/authorizer/SingleVoteGovernor.t.sol +++ b/test/modules/authorizer/SingleVoteGovernor.t.sol @@ -12,6 +12,7 @@ import { // External Libraries import {Clones} from "@oz/proxy/Clones.sol"; +import {ModuleTest, IModule, IOrchestrator} from "test/modules/ModuleTest.sol"; // Internal Dependencies import {Orchestrator} from "src/orchestrator/Orchestrator.sol"; @@ -29,38 +30,22 @@ import {PaymentProcessorMock} from "test/utils/mocks/modules/PaymentProcessorMock.sol"; import {AuthorizerMock} from "test/utils/mocks/modules/AuthorizerMock.sol"; -contract SingleVoteGovernorTest is Test { +contract SingleVoteGovernorTest is ModuleTest { bool hasDependency; string[] dependencies = new string[](0); // SuT SingleVoteGovernor _governor; - Orchestrator _orchestrator; + //Orchestrator _orchestrator; address[] initialVoters; address[] currentVoters; // Constants and other data structures uint internal constant DEFAULT_QUORUM = 2; uint internal constant DEFAULT_DURATION = 4 days; - // For the orchestrator - uint internal constant _ORCHESTRATOR_ID = 1; - // For the metadata - uint constant MAJOR_VERSION = 1; - uint constant MINOR_VERSION = 1; - string constant URL = "https://github.com/organization/module"; - string constant TITLE = "Module"; - - IModule.Metadata _METADATA = - IModule.Metadata(MAJOR_VERSION, MINOR_VERSION, URL, TITLE); - - // Mocks - ERC20Mock internal _token = new ERC20Mock("Mock Token", "MOCK"); - FundingManagerMock _fundingManager = new FundingManagerMock(); - PaymentProcessorMock _paymentProcessor = new PaymentProcessorMock(); - AuthorizerMock _authorizer = new AuthorizerMock(); - ModuleMock module = new ModuleMock(); - // Mock users + + // intial authorizd users address internal constant ALBA = address(0xa1ba); address internal constant BOB = address(0xb0b); @@ -72,27 +57,14 @@ contract SingleVoteGovernorTest is Test { address authImpl = address(new SingleVoteGovernor()); _governor = SingleVoteGovernor(Clones.clone(authImpl)); - address impl = address(new Orchestrator()); - _orchestrator = Orchestrator(Clones.clone(impl)); - - address[] memory modules = new address[](1); - modules[0] = address(_governor); - - _orchestrator.init( - _ORCHESTRATOR_ID, - _token, - modules, - _fundingManager, - _authorizer, - _paymentProcessor - ); + _setUpOrchestrator(_governor); //we give the governor the ownwer role bytes32 ownerRole = _authorizer.getOwnerRole(); _authorizer.grantRole(ownerRole, address(_governor)); //_authorizer.setIsAuthorized(address(_governor), true); - // Initialize the authorizer with 3 users + // Initialize the governor with 3 users initialVoters = new address[](3); initialVoters[0] = ALBA; @@ -108,32 +80,12 @@ contract SingleVoteGovernorTest is Test { abi.encode(initialVoters, _startingThreshold, _startingDuration) ); - _authorizer.init2(_orchestrator, dependencyData); - - - - console.log(address(_authorizer.orchestrator())); - console.log(address(_orchestrator)); - - assertEq(address(_authorizer.orchestrator()), address(_orchestrator)); - assertEq(_orchestrator.isModule(address(_governor)), true); - - assertEq(_authorizer.isAuthorized(address(_governor)), true); - assertEq(_governor.isVoter(ALBA), true); - assertEq(_governor.isVoter(BOB), true); - assertEq(_governor.isVoter(COBIE), true); - currentVoters.push(ALBA); currentVoters.push(BOB); currentVoters.push(COBIE); - // The deployer may be owner, but not authorized by default - assertEq(_authorizer.isAuthorized(address(this)), false); - assertEq(_authorizer.isAuthorized(address(_orchestrator)), false); - assertEq(_governor.isVoter(address(this)), false); - assertEq(_governor.isVoter(address(_orchestrator)), false); + //validation of the initial state happens in testInit() - assertEq(_governor.voterCount(), 3); } //-------------------------------------------------------------------------- @@ -271,6 +223,22 @@ contract SingleVoteGovernorTest is Test { //-------------------------------------------------------------------------- // TESTS: INITIALIZATION + function testInit() public override(ModuleTest) { + assertEq(_orchestrator.isModule(address(_governor)), true); + + assertEq(_authorizer.isAuthorized(address(_governor)), true); + assertEq(_governor.isVoter(ALBA), true); + assertEq(_governor.isVoter(BOB), true); + assertEq(_governor.isVoter(COBIE), true); + + assertEq(_authorizer.isAuthorized(address(this)), false); + assertEq(_authorizer.isAuthorized(address(_orchestrator)), false); + assertEq(_governor.isVoter(address(this)), false); + assertEq(_governor.isVoter(address(_orchestrator)), false); + + assertEq(_governor.voterCount(), 3); + } + function testInitWithInitialVoters(address[] memory testVoters) public { //Checks that address list gets correctly stored on initialization // We "reuse" the orchestrator created in the setup, but the orchestrator doesn't know about this new authorizer. @@ -341,7 +309,7 @@ contract SingleVoteGovernorTest is Test { ); } - function testReinitFails() public { + function testReinitFails() public override { //Create a mock new orchestrator Orchestrator newOrchestrator = Orchestrator(Clones.clone(address(new Orchestrator()))); @@ -1050,8 +1018,6 @@ contract SingleVoteGovernorTest is Test { // Fail to remove Authorized addresses until threshold is unreachble function testRemoveTooManyVoters() public { - assertEq(address(_orchestrator), address(_authorizer.orchestrator())); - vm.startPrank(address(_governor)); _governor.removeVoter(COBIE); @@ -1068,8 +1034,6 @@ contract SingleVoteGovernorTest is Test { // Fail to remove Authorized addresses until the voterlist is empty function testRemoveUntilVoterListEmpty() public { - assertEq(address(_orchestrator), address(_authorizer.orchestrator())); - vm.startPrank(address(_governor)); _governor.setThreshold(0); @@ -1261,7 +1225,7 @@ contract SingleVoteGovernorTest is Test { invalids[2] = address(_governor); invalids[3] = address(_paymentProcessor); invalids[4] = address(_token); - invalids[5] = address(module); + invalids[5] = address(_authorizer); invalids[6] = address(this); invalids[7] = ALBA; invalids[8] = BOB; diff --git a/test/utils/mocks/modules/AuthorizerMock.sol b/test/utils/mocks/modules/AuthorizerMock.sol index 235f3ad5f..86f4dde53 100644 --- a/test/utils/mocks/modules/AuthorizerMock.sol +++ b/test/utils/mocks/modules/AuthorizerMock.sol @@ -39,7 +39,6 @@ contract AuthorizerMock is IAuthorizer, Module { .sender] = true; _roleAuthorized[generateRoleId(address(orchestrator()), uint8(1))][msg .sender] = true; - } function mockInit(bytes memory configData) public { From 891b3dc3b6539bfc1593f5284415d460890de055 Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Wed, 2 Aug 2023 14:35:56 +0200 Subject: [PATCH 09/32] authorizer housekeeping --- src/modules/authorizer/IAuthorizer.sol | 18 ++++++++++++++++++ src/modules/authorizer/RoleAuthorizer.sol | 6 ++++-- test/factories/ProposalFactory.t.sol | 7 +------ .../authorizer/SingleVoteGovernor.t.sol | 2 -- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/modules/authorizer/IAuthorizer.sol b/src/modules/authorizer/IAuthorizer.sol index abe309a7a..b61452290 100644 --- a/src/modules/authorizer/IAuthorizer.sol +++ b/src/modules/authorizer/IAuthorizer.sol @@ -76,7 +76,25 @@ interface IAuthorizer is IAccessControlEnumerableUpgradeable { /// @dev The module itself can still grant and revoke it's own roles. This only burns third-party access to the role. function burnAdminRole(uint8 role) external; + /// @notice Grants a global role to a target + /// @param role The role to grant + /// @param target The address to grant the role to + /// @dev Only the addresses with the Owner role should be able to call this function + function grantGlobalRole(uint8 role, address target) external; + + + /// @notice Revokes a global role from a target + /// @param role The role to grant + /// @param target The address to grant the role to + /// @dev Only the addresses with the Owner role should be able to call this function + function revokeGlobalRole(uint8 role, address target) external; + + /// @notice Returns the role ID of the owner role + /// @return The role ID function getOwnerRole() external returns (bytes32); + + /// @notice Returns the role ID of the manager role + /// @return The role ID function getManagerRole() external returns (bytes32); } diff --git a/src/modules/authorizer/RoleAuthorizer.sol b/src/modules/authorizer/RoleAuthorizer.sol index 77e9746b8..4916d0957 100644 --- a/src/modules/authorizer/RoleAuthorizer.sol +++ b/src/modules/authorizer/RoleAuthorizer.sol @@ -231,8 +231,7 @@ contract RoleAuthorizer is _setRoleAdmin(roleId, BURN_ADMIN_ROLE); } - //TODO: Add to interface and natspec - + /// @inheritdoc IAuthorizer function grantGlobalRole(uint8 role, address target) external onlyRole(ORCHESTRATOR_OWNER_ROLE) @@ -241,6 +240,7 @@ contract RoleAuthorizer is _grantRole(roleId, target); } + /// @inheritdoc IAuthorizer function revokeGlobalRole(uint8 role, address target) external onlyRole(ORCHESTRATOR_OWNER_ROLE) @@ -249,10 +249,12 @@ contract RoleAuthorizer is _revokeRole(roleId, target); } + /// @inheritdoc IAuthorizer function getOwnerRole() public view returns (bytes32) { return ORCHESTRATOR_OWNER_ROLE; } + /// @inheritdoc IAuthorizer function getManagerRole() public view returns (bytes32) { return ORCHESTRATOR_MANAGER_ROLE; } diff --git a/test/factories/ProposalFactory.t.sol b/test/factories/ProposalFactory.t.sol index 11c8ebeb9..8f7c3aee9 100644 --- a/test/factories/ProposalFactory.t.sol +++ b/test/factories/ProposalFactory.t.sol @@ -55,7 +55,7 @@ contract OrchestratorFactoryTest is Test { IOrchestratorFactory.ModuleConfig authorizerConfig = IOrchestratorFactory .ModuleConfig( IModule.Metadata(1, 1, "https://authorizer.com", "Authorizer"), - bytes("data"), + abi.encode(address(this), address(this)), abi.encode(hasDependency, dependencies) ); @@ -137,11 +137,6 @@ contract OrchestratorFactoryTest is Test { assertTrue(address(orchestrator.authorizer()) != address(0)); assertTrue(address(orchestrator.paymentProcessor()) != address(0)); - // Check that other orchestrator's dependencies correctly initialized. - // Ownable: TODO - //bytes32 managerRole = orchestrator.authorizer().getManagerRole(); - //assertTrue(orchestrator.authorizer().hasRole(managerRole, address(orchestratorConfig.owner))); - // Deploy Orchestrator with id=2 orchestrator = factory.createOrchestrator( orchestratorConfig, diff --git a/test/modules/authorizer/SingleVoteGovernor.t.sol b/test/modules/authorizer/SingleVoteGovernor.t.sol index 6a284ec4c..7eef70b79 100644 --- a/test/modules/authorizer/SingleVoteGovernor.t.sol +++ b/test/modules/authorizer/SingleVoteGovernor.t.sol @@ -45,7 +45,6 @@ contract SingleVoteGovernorTest is ModuleTest { uint internal constant DEFAULT_QUORUM = 2; uint internal constant DEFAULT_DURATION = 4 days; - // intial authorizd users address internal constant ALBA = address(0xa1ba); address internal constant BOB = address(0xb0b); @@ -85,7 +84,6 @@ contract SingleVoteGovernorTest is ModuleTest { currentVoters.push(COBIE); //validation of the initial state happens in testInit() - } //-------------------------------------------------------------------------- From ee19bcfff10af31ae4c4443bb61d6f5229324673 Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Wed, 2 Aug 2023 14:55:58 +0200 Subject: [PATCH 10/32] add missing tests --- src/modules/authorizer/IAuthorizer.sol | 6 +-- test/modules/authorizer/RoleAuthorizer.t.sol | 45 ++++++++++++++++++++ test/modules/base/Module.t.sol | 21 --------- test/utils/mocks/modules/AuthorizerMock.sol | 25 ++++++++++- 4 files changed, 70 insertions(+), 27 deletions(-) diff --git a/src/modules/authorizer/IAuthorizer.sol b/src/modules/authorizer/IAuthorizer.sol index b61452290..6f611b83e 100644 --- a/src/modules/authorizer/IAuthorizer.sol +++ b/src/modules/authorizer/IAuthorizer.sol @@ -82,7 +82,6 @@ interface IAuthorizer is IAccessControlEnumerableUpgradeable { /// @dev Only the addresses with the Owner role should be able to call this function function grantGlobalRole(uint8 role, address target) external; - /// @notice Revokes a global role from a target /// @param role The role to grant /// @param target The address to grant the role to @@ -90,11 +89,10 @@ interface IAuthorizer is IAccessControlEnumerableUpgradeable { function revokeGlobalRole(uint8 role, address target) external; /// @notice Returns the role ID of the owner role - /// @return The role ID + /// @return The role ID function getOwnerRole() external returns (bytes32); - /// @notice Returns the role ID of the manager role - /// @return The role ID + /// @return The role ID function getManagerRole() external returns (bytes32); } diff --git a/test/modules/authorizer/RoleAuthorizer.t.sol b/test/modules/authorizer/RoleAuthorizer.t.sol index e3fb14b7a..846cc1567 100644 --- a/test/modules/authorizer/RoleAuthorizer.t.sol +++ b/test/modules/authorizer/RoleAuthorizer.t.sol @@ -626,6 +626,51 @@ contract RoleAuthorizerTest is Test { // Test grant and revoke global roles // TODO + // Grant global roles + function testGrantGlobalRole() public { + bytes32 globalRole = + _authorizer.generateRoleId(address(_orchestrator), uint8(3)); + vm.prank(ALBA); + _authorizer.grantGlobalRole(uint8(3), BOB); + assertTrue(_authorizer.hasRole(globalRole, BOB)); + } + + function testGrantGlobalRoleFailsIfNotOwner() public { + bytes32 globalRole = + _authorizer.generateRoleId(address(_orchestrator), uint8(3)); + vm.prank(BOB); + vm.expectRevert(); + _authorizer.grantGlobalRole(uint8(3), ALBA); + assertFalse(_authorizer.hasRole(globalRole, ALBA)); + } + + // Revoke global roles + function testRevokeGlobalRole() public { + bytes32 globalRole = + _authorizer.generateRoleId(address(_orchestrator), uint8(3)); + vm.startPrank(ALBA); + _authorizer.grantGlobalRole(uint8(3), BOB); + assertTrue(_authorizer.hasRole(globalRole, BOB)); + + _authorizer.revokeGlobalRole(uint8(3), BOB); + assertEq(_authorizer.hasRole(globalRole, BOB), false); + + vm.stopPrank(); + } + + function testRevokeGlobalRoleFailsIfNotOwner() public { + bytes32 globalRole = + _authorizer.generateRoleId(address(_orchestrator), uint8(3)); + vm.prank(ALBA); + _authorizer.grantGlobalRole(uint8(3), BOB); + assertTrue(_authorizer.hasRole(globalRole, BOB)); + + vm.prank(BOB); + vm.expectRevert(); + _authorizer.revokeGlobalRole(uint8(3), BOB); + assertTrue(_authorizer.hasRole(globalRole, BOB)); + } + // ========================================================================= // Test granting and revoking ADMIN control, and test admin control over module roles diff --git a/test/modules/base/Module.t.sol b/test/modules/base/Module.t.sol index b05e35beb..35da0822d 100644 --- a/test/modules/base/Module.t.sol +++ b/test/modules/base/Module.t.sol @@ -145,25 +145,4 @@ contract ModuleTest is Test { CONFIGDATA ); } - - //-------------------------------------------------------------------------- - // Access control tests - // TODO: write tests for the modifiers - - /* //note: if someone has a better idea to test this, it would be most welcome - function testOnlyRole(bool authorized) public { - if (!authorized) { - authorizer.setIsAuthorized(address(this), false); - //onlyBountyAdmin - vm.expectRevert( - abi.encodeWithSelector( - IModule.Module__CallerNotAuthorized.selector //, - //IBountyManager.Roles.BountyAdmin, - //address(bountyManager) - ) - ); - } - bountyManager.addBounty(1, 2, bytes("")); - } - */ } diff --git a/test/utils/mocks/modules/AuthorizerMock.sol b/test/utils/mocks/modules/AuthorizerMock.sol index 86f4dde53..577dc9af1 100644 --- a/test/utils/mocks/modules/AuthorizerMock.sol +++ b/test/utils/mocks/modules/AuthorizerMock.sol @@ -108,7 +108,7 @@ contract AuthorizerMock is IAuthorizer, Module { return 0; } - function grantRole(bytes32 role, address who) external { + function grantRole(bytes32 role, address who) public { _roleAuthorized[role][who] = true; } @@ -116,7 +116,9 @@ contract AuthorizerMock is IAuthorizer, Module { return _authorized[who] || _roleAuthorized[role][who] || _allAuthorized; } - function revokeRole(bytes32, address) external pure {} + function revokeRole(bytes32 role, address who) public { + _roleAuthorized[role][who] = false; + } function renounceRole(bytes32, address) external pure {} @@ -127,4 +129,23 @@ contract AuthorizerMock is IAuthorizer, Module { function getManagerRole() external view returns (bytes32) { return generateRoleId(address(orchestrator()), uint8(1)); } + + /// @notice Grants a global role to a target + /// @param role The role to grant + /// @param target The address to grant the role to + /// @dev Only the addresses with the Owner role should be able to call this function + function grantGlobalRole(uint8 role, address target) external{ + bytes32 roleID = generateRoleId(address(orchestrator()), role); + grantRole(roleID, target); + } + + /// @notice Revokes a global role from a target + /// @param role The role to grant + /// @param target The address to grant the role to + /// @dev Only the addresses with the Owner role should be able to call this function + function revokeGlobalRole(uint8 role, address target) external{ + bytes32 roleID = generateRoleId(address(orchestrator()), role); + revokeRole(roleID, target); + + } } From 6241b069ad8c448033f213ddd9200993de88defc Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Wed, 2 Aug 2023 15:02:10 +0200 Subject: [PATCH 11/32] further cleanup --- src/modules/authorizer/IRoleAuthorizer.sol | 1 - src/modules/authorizer/SingleVoteGovernor.sol | 14 -------- src/modules/logicModule/IBountyManager.sol | 34 ------------------- test/modules/logicModule/BountyManager.t.sol | 20 +++-------- 4 files changed, 5 insertions(+), 64 deletions(-) delete mode 100644 src/modules/authorizer/IRoleAuthorizer.sol diff --git a/src/modules/authorizer/IRoleAuthorizer.sol b/src/modules/authorizer/IRoleAuthorizer.sol deleted file mode 100644 index 8b1378917..000000000 --- a/src/modules/authorizer/IRoleAuthorizer.sol +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/modules/authorizer/SingleVoteGovernor.sol b/src/modules/authorizer/SingleVoteGovernor.sol index e2656569a..e200ee86d 100644 --- a/src/modules/authorizer/SingleVoteGovernor.sol +++ b/src/modules/authorizer/SingleVoteGovernor.sol @@ -140,20 +140,6 @@ contract SingleVoteGovernor is ISingleVoteGovernor, Module { emit VoteDurationUpdated(0, voteDuration_); } - //-------------------------------------------------------------------------- - // IAuthorizer Functions - - /* /// @inheritdoc IAuthorizer - function isAuthorized(address who) - public - view - override(IAuthorizer) - returns (bool) - { - // Note that only the governance itself is authorized. - return who == address(this); - } */ - //-------------------------------------------------------------------------- // Data Retrieval Functions diff --git a/src/modules/logicModule/IBountyManager.sol b/src/modules/logicModule/IBountyManager.sol index fd7916e62..dd065fd2e 100644 --- a/src/modules/logicModule/IBountyManager.sol +++ b/src/modules/logicModule/IBountyManager.sol @@ -229,38 +229,4 @@ interface IBountyManager is IERC20PaymentClient { /// @param bountyId The id of the Bounty that will be claimed. function verifyClaim(uint claimId, uint bountyId) external; - //---------------------------------- - // Role Functions - /* - /// @notice Grants the BountyAdmin Role to a specified address - /// @dev Only callable by authorized addresses. - /// @param addr Address that gets the role granted - function grantBountyAdminRole(address addr) external; - - /// @notice Grants the ClaimAdmin Role to a specified address - /// @dev Only callable by authorized addresses. - /// @param addr Address that gets the role granted - function grantClaimAdminRole(address addr) external; - - /// @notice Grants the VerifyAdmin Role to a specified address - /// @dev Only callable by authorized addresses. - /// @param addr Address that gets the role granted - function grantVerifyAdminRole(address addr) external; - - /// @notice Revokes the BountyAdmin Role from a specified address - /// @dev Only callable by authorized addresses. - /// @param addr Address that gets their role revoked - function revokeBountyAdminRole(address addr) external; - - /// @notice Revokes the ClaimAdmin Role from a specified address - /// @dev Only callable by authorized addresses. - /// @param addr Address that gets their role revoked - function revokeClaimAdminRole(address addr) external; - - /// @notice Revokes the VerifyAdmin Role from a specified address - /// @dev Only callable by authorized addresses. - /// @param addr Address that gets their role revoked - function revokeVerifyAdminRole(address addr) external; - - */ } diff --git a/test/modules/logicModule/BountyManager.t.sol b/test/modules/logicModule/BountyManager.t.sol index 72a246d78..16fd573fb 100644 --- a/test/modules/logicModule/BountyManager.t.sol +++ b/test/modules/logicModule/BountyManager.t.sol @@ -378,9 +378,7 @@ contract BountyManagerTest is ModuleTest { //onlyBountyAdmin vm.expectRevert( abi.encodeWithSelector( - IModule.Module__CallerNotAuthorized.selector /*, - IBountyManager.Roles.BountyAdmin, - address(bountyManager)*/ + IModule.Module__CallerNotAuthorized.selector ) ); bountyManager.addBounty(0, 0, bytes("")); @@ -459,9 +457,7 @@ contract BountyManagerTest is ModuleTest { //onlyClaimAdmin vm.expectRevert( abi.encodeWithSelector( - IModule.Module__CallerNotAuthorized.selector /*, - IBountyManager.Roles.ClaimAdmin, - address(bountyManager)*/ + IModule.Module__CallerNotAuthorized.selector ) ); bountyManager.addClaim(0, DEFAULT_CONTRIBUTORS, bytes("")); @@ -496,9 +492,7 @@ contract BountyManagerTest is ModuleTest { //onlyBountyAdmin vm.expectRevert( abi.encodeWithSelector( - IModule.Module__CallerNotAuthorized.selector /*, - IBountyManager.Roles.BountyAdmin, - address(bountyManager)*/ + IModule.Module__CallerNotAuthorized.selector ) ); bountyManager.updateBounty(0, bytes("")); @@ -542,9 +536,7 @@ contract BountyManagerTest is ModuleTest { //onlyBountyAdmin vm.expectRevert( abi.encodeWithSelector( - IModule.Module__CallerNotAuthorized.selector /*, - IBountyManager.Roles.BountyAdmin, - address(bountyManager)*/ + IModule.Module__CallerNotAuthorized.selector ) ); bountyManager.lockBounty(0); @@ -772,9 +764,7 @@ contract BountyManagerTest is ModuleTest { //onlyVerifyAdmin vm.expectRevert( abi.encodeWithSelector( - IModule.Module__CallerNotAuthorized.selector /*, - IBountyManager.Roles.BountyAdmin, - address(bountyManager)*/ + IModule.Module__CallerNotAuthorized.selector ) ); bountyManager.verifyClaim(0, 1); From 50200d3a7e704c4184f7fe3328d0db20da96157b Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Wed, 2 Aug 2023 15:04:51 +0200 Subject: [PATCH 12/32] format --- src/modules/logicModule/IBountyManager.sol | 1 - test/modules/logicModule/BountyManager.t.sol | 20 +++++--------------- test/utils/mocks/modules/AuthorizerMock.sol | 9 ++++----- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/modules/logicModule/IBountyManager.sol b/src/modules/logicModule/IBountyManager.sol index dd065fd2e..22569b951 100644 --- a/src/modules/logicModule/IBountyManager.sol +++ b/src/modules/logicModule/IBountyManager.sol @@ -228,5 +228,4 @@ interface IBountyManager is IERC20PaymentClient { /// @param claimId The id of the Claim that wants to claim the Bounty. /// @param bountyId The id of the Bounty that will be claimed. function verifyClaim(uint claimId, uint bountyId) external; - } diff --git a/test/modules/logicModule/BountyManager.t.sol b/test/modules/logicModule/BountyManager.t.sol index 16fd573fb..450907caf 100644 --- a/test/modules/logicModule/BountyManager.t.sol +++ b/test/modules/logicModule/BountyManager.t.sol @@ -377,9 +377,7 @@ contract BountyManagerTest is ModuleTest { //onlyBountyAdmin vm.expectRevert( - abi.encodeWithSelector( - IModule.Module__CallerNotAuthorized.selector - ) + abi.encodeWithSelector(IModule.Module__CallerNotAuthorized.selector) ); bountyManager.addBounty(0, 0, bytes("")); } @@ -456,9 +454,7 @@ contract BountyManagerTest is ModuleTest { //onlyClaimAdmin vm.expectRevert( - abi.encodeWithSelector( - IModule.Module__CallerNotAuthorized.selector - ) + abi.encodeWithSelector(IModule.Module__CallerNotAuthorized.selector) ); bountyManager.addClaim(0, DEFAULT_CONTRIBUTORS, bytes("")); } @@ -491,9 +487,7 @@ contract BountyManagerTest is ModuleTest { //onlyBountyAdmin vm.expectRevert( - abi.encodeWithSelector( - IModule.Module__CallerNotAuthorized.selector - ) + abi.encodeWithSelector(IModule.Module__CallerNotAuthorized.selector) ); bountyManager.updateBounty(0, bytes("")); } @@ -535,9 +529,7 @@ contract BountyManagerTest is ModuleTest { //onlyBountyAdmin vm.expectRevert( - abi.encodeWithSelector( - IModule.Module__CallerNotAuthorized.selector - ) + abi.encodeWithSelector(IModule.Module__CallerNotAuthorized.selector) ); bountyManager.lockBounty(0); } @@ -763,9 +755,7 @@ contract BountyManagerTest is ModuleTest { //onlyVerifyAdmin vm.expectRevert( - abi.encodeWithSelector( - IModule.Module__CallerNotAuthorized.selector - ) + abi.encodeWithSelector(IModule.Module__CallerNotAuthorized.selector) ); bountyManager.verifyClaim(0, 1); } diff --git a/test/utils/mocks/modules/AuthorizerMock.sol b/test/utils/mocks/modules/AuthorizerMock.sol index 577dc9af1..20f1cfc9c 100644 --- a/test/utils/mocks/modules/AuthorizerMock.sol +++ b/test/utils/mocks/modules/AuthorizerMock.sol @@ -116,7 +116,7 @@ contract AuthorizerMock is IAuthorizer, Module { return _authorized[who] || _roleAuthorized[role][who] || _allAuthorized; } - function revokeRole(bytes32 role, address who) public { + function revokeRole(bytes32 role, address who) public { _roleAuthorized[role][who] = false; } @@ -130,11 +130,11 @@ contract AuthorizerMock is IAuthorizer, Module { return generateRoleId(address(orchestrator()), uint8(1)); } - /// @notice Grants a global role to a target + /// @notice Grants a global role to a target /// @param role The role to grant /// @param target The address to grant the role to /// @dev Only the addresses with the Owner role should be able to call this function - function grantGlobalRole(uint8 role, address target) external{ + function grantGlobalRole(uint8 role, address target) external { bytes32 roleID = generateRoleId(address(orchestrator()), role); grantRole(roleID, target); } @@ -143,9 +143,8 @@ contract AuthorizerMock is IAuthorizer, Module { /// @param role The role to grant /// @param target The address to grant the role to /// @dev Only the addresses with the Owner role should be able to call this function - function revokeGlobalRole(uint8 role, address target) external{ + function revokeGlobalRole(uint8 role, address target) external { bytes32 roleID = generateRoleId(address(orchestrator()), role); revokeRole(roleID, target); - } } From 03ded1714e5ff9955a63882b8a400b60b760758c Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Thu, 3 Aug 2023 16:17:12 +0200 Subject: [PATCH 13/32] fix code review issues --- lcov.info | 4 +- .../governance/DeploySingleVoteGovernor.s.sol | 2 +- src/modules/authorizer/IAuthorizer.sol | 4 +- src/modules/authorizer/RoleAuthorizer.sol | 2 +- src/modules/base/Module.sol | 18 +-- src/modules/logicModule/BountyManager.sol | 3 +- src/modules/{ => utils}/IMetadataManager.sol | 0 .../ISingleVoteGovernor.sol | 0 src/modules/{ => utils}/MetadataManager.sol | 2 +- .../SingleVoteGovernor.sol | 2 +- src/orchestrator/IOrchestrator.sol | 2 +- src/orchestrator/Orchestrator.sol | 4 - src/orchestrator/base/ModuleManager.sol | 2 +- test/e2e/BountyManagerLifecycle.t.sol | 2 +- test/e2e/CreateNewOrchestrator.t.sol | 5 +- test/modules/MetadataManager.t.sol | 5 +- .../authorizer/SingleVoteGovernor.t.sol | 2 +- test/modules/base/Module.t.sol | 133 ++++++++++++------ test/modules/logicModule/BountyManager.t.sol | 23 --- .../logicModule/RecurringPaymentManager.t.sol | 4 +- .../StreamingPaymentProcessor.t.sol | 4 +- test/orchestrator/Orchestrator.t.sol | 12 +- test/utils/mocks/modules/AuthorizerMock.sol | 15 +- 23 files changed, 133 insertions(+), 117 deletions(-) rename src/modules/{ => utils}/IMetadataManager.sol (100%) rename src/modules/{authorizer => utils}/ISingleVoteGovernor.sol (100%) rename src/modules/{ => utils}/MetadataManager.sol (98%) rename src/modules/{authorizer => utils}/SingleVoteGovernor.sol (99%) diff --git a/lcov.info b/lcov.info index 85608bd60..6ebe177b1 100644 --- a/lcov.info +++ b/lcov.info @@ -505,7 +505,7 @@ BRF:0 BRH:0 end_of_record TN: -SF:src/modules/MetadataManager.sol +SF:src/modules/utils/MetadataManager.sol FN:23,MetadataManager.init FNDA:3,MetadataManager.init DA:28,2 @@ -625,7 +625,7 @@ BRF:6 BRH:6 end_of_record TN: -SF:src/modules/authorizer/SingleVoteGovernor.sol +SF:src/modules/utils/SingleVoteGovernor.sol FN:75,SingleVoteGovernor.init FNDA:517,SingleVoteGovernor.init DA:80,516 diff --git a/script/modules/governance/DeploySingleVoteGovernor.s.sol b/script/modules/governance/DeploySingleVoteGovernor.s.sol index 1c0c70726..2a29db13a 100644 --- a/script/modules/governance/DeploySingleVoteGovernor.s.sol +++ b/script/modules/governance/DeploySingleVoteGovernor.s.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.0; import "forge-std/Script.sol"; -import {SingleVoteGovernor} from "src/modules/authorizer/SingleVoteGovernor.sol"; +import {SingleVoteGovernor} from "src/modules/utils/SingleVoteGovernor.sol"; /** * @title SingleVoteGovernor Deployment Script diff --git a/src/modules/authorizer/IAuthorizer.sol b/src/modules/authorizer/IAuthorizer.sol index 6f611b83e..ba9a0ea55 100644 --- a/src/modules/authorizer/IAuthorizer.sol +++ b/src/modules/authorizer/IAuthorizer.sol @@ -36,7 +36,7 @@ interface IAuthorizer is IAccessControlEnumerableUpgradeable { /// the current transaction. /// @param role The identifier of the role we want to check /// @param who The address on which to perform the check. - /// @dev If the role is not self-managed, it will default to the proposal roles + /// @dev If the role is not self-managed, it will default to the orchestrator roles /// @dev If not, it will use the calling address to generate the role ID. Therefore, for checking on anything other than itself, hasRole() should be used function isAuthorized(uint8 role, address who) external @@ -63,7 +63,7 @@ interface IAuthorizer is IAccessControlEnumerableUpgradeable { /// @param target The address to revoke the role from. function revokeRoleFromModule(uint8 role, address target) external; - /// @notice Toggles if a Module self-manages its roles or defaults to the proposal's roles. + /// @notice Toggles if a Module self-manages its roles or defaults to the orchestrator's roles. function toggleModuleSelfManagement() external; /// @notice Transfer the admin rights to a given role. diff --git a/src/modules/authorizer/RoleAuthorizer.sol b/src/modules/authorizer/RoleAuthorizer.sol index 4916d0957..63f1efd55 100644 --- a/src/modules/authorizer/RoleAuthorizer.sol +++ b/src/modules/authorizer/RoleAuthorizer.sol @@ -100,7 +100,7 @@ contract RoleAuthorizer is ORCHESTRATOR_MANAGER_ROLE = generateRoleId(address(orchestrator()), uint8(CoreRoles.MANAGER)); - //We preliminarily grant admin role to the deployer + //We preliminarily grant admin role to the caller _grantRole(ORCHESTRATOR_OWNER_ROLE, _msgSender()); // Set up OWNER role structure: diff --git a/src/modules/base/Module.sol b/src/modules/base/Module.sol index e7f941953..ff314dfde 100644 --- a/src/modules/base/Module.sol +++ b/src/modules/base/Module.sol @@ -62,8 +62,7 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { /// @notice Modifier to guarantee function is only callable by addresses /// authorized via Orchestrator. modifier onlyOrchestratorOwner() { - IAuthorizer authorizer = - IAuthorizer(address(__Module_orchestrator.authorizer())); + IAuthorizer authorizer = __Module_orchestrator.authorizer(); bytes32 ownerRole = authorizer.getOwnerRole(); @@ -76,8 +75,7 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { /// @notice Modifier to guarantee function is only callable by either /// addresses authorized via Orchestrator or the Orchestrator's manager. modifier onlyOrchestratorOwnerOrManager() { - IAuthorizer authorizer = - IAuthorizer(address(__Module_orchestrator.authorizer())); + IAuthorizer authorizer = __Module_orchestrator.authorizer(); bytes32 ownerRole = authorizer.getOwnerRole(); bytes32 managerRole = authorizer.getManagerRole(); @@ -94,10 +92,10 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { /// @notice Modifier to guarantee function is only callable by addresses that hold a specific module-assigned role. modifier onlyModuleRole(uint8 roleId) { if ( - !IAuthorizer(address(__Module_orchestrator.authorizer())) - .isAuthorized(roleId, _msgSender()) + !__Module_orchestrator.authorizer().isAuthorized( + roleId, _msgSender() + ) ) { - //revert Module__BountyManager__OnlyRole(roleId, address(this)); revert Module__CallerNotAuthorized(); } _; @@ -208,8 +206,7 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { external onlyOrchestratorOwner { - IAuthorizer roleAuthorizer = - IAuthorizer(address(__Module_orchestrator.authorizer())); + IAuthorizer roleAuthorizer = __Module_orchestrator.authorizer(); roleAuthorizer.grantRoleFromModule(uint8(role), addr); } @@ -217,8 +214,7 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { external onlyOrchestratorOwner { - IAuthorizer roleAuthorizer = - IAuthorizer(address(__Module_orchestrator.authorizer())); + IAuthorizer roleAuthorizer = __Module_orchestrator.authorizer(); roleAuthorizer.revokeRoleFromModule(uint8(role), addr); } diff --git a/src/modules/logicModule/BountyManager.sol b/src/modules/logicModule/BountyManager.sol index c33aa07fa..3dce52afa 100644 --- a/src/modules/logicModule/BountyManager.sol +++ b/src/modules/logicModule/BountyManager.sol @@ -192,8 +192,7 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { { //Note: due to the authorizer still not being set during initialization, // this function has to be called after. - IAuthorizer(address(orchestrator().authorizer())) - .toggleModuleSelfManagement(); + orchestrator().authorizer().toggleModuleSelfManagement(); } //-------------------------------------------------------------------------- diff --git a/src/modules/IMetadataManager.sol b/src/modules/utils/IMetadataManager.sol similarity index 100% rename from src/modules/IMetadataManager.sol rename to src/modules/utils/IMetadataManager.sol diff --git a/src/modules/authorizer/ISingleVoteGovernor.sol b/src/modules/utils/ISingleVoteGovernor.sol similarity index 100% rename from src/modules/authorizer/ISingleVoteGovernor.sol rename to src/modules/utils/ISingleVoteGovernor.sol diff --git a/src/modules/MetadataManager.sol b/src/modules/utils/MetadataManager.sol similarity index 98% rename from src/modules/MetadataManager.sol rename to src/modules/utils/MetadataManager.sol index b37c4c18d..6860b5ae1 100644 --- a/src/modules/MetadataManager.sol +++ b/src/modules/utils/MetadataManager.sol @@ -5,7 +5,7 @@ pragma solidity 0.8.19; import {Module} from "src/modules/base/Module.sol"; // Internal Interfaces -import {IMetadataManager} from "src/modules/IMetadataManager.sol"; +import {IMetadataManager} from "src/modules/utils/IMetadataManager.sol"; import {IOrchestrator} from "src/orchestrator/IOrchestrator.sol"; contract MetadataManager is IMetadataManager, Module { diff --git a/src/modules/authorizer/SingleVoteGovernor.sol b/src/modules/utils/SingleVoteGovernor.sol similarity index 99% rename from src/modules/authorizer/SingleVoteGovernor.sol rename to src/modules/utils/SingleVoteGovernor.sol index e200ee86d..850e04971 100644 --- a/src/modules/authorizer/SingleVoteGovernor.sol +++ b/src/modules/utils/SingleVoteGovernor.sol @@ -8,7 +8,7 @@ import {IOrchestrator} from "src/orchestrator/IOrchestrator.sol"; import { ISingleVoteGovernor, IAuthorizer -} from "src/modules/authorizer/ISingleVoteGovernor.sol"; +} from "src/modules/utils/ISingleVoteGovernor.sol"; contract SingleVoteGovernor is ISingleVoteGovernor, Module { //-------------------------------------------------------------------------- diff --git a/src/orchestrator/IOrchestrator.sol b/src/orchestrator/IOrchestrator.sol index 52f9fb990..d8edab8a2 100644 --- a/src/orchestrator/IOrchestrator.sol +++ b/src/orchestrator/IOrchestrator.sol @@ -95,7 +95,7 @@ interface IOrchestrator is IModuleManager { /// @notice The version of the orchestrator instance. function version() external pure returns (string memory); - /// @notice find the address of a given module using it's name in a proposal + /// @notice find the address of a given module using it's name in a orchestrator function findModuleAddressInOrchestrator(string calldata moduleName) external view diff --git a/src/orchestrator/Orchestrator.sol b/src/orchestrator/Orchestrator.sol index 259e96659..ac2e174f5 100644 --- a/src/orchestrator/Orchestrator.sol +++ b/src/orchestrator/Orchestrator.sol @@ -113,10 +113,6 @@ contract Orchestrator is IOrchestrator, ModuleManager { authorizer = authorizer_; paymentProcessor = paymentProcessor_; - // Transfer ownerhsip of proposal to owner argument. - //_transferOwnership(manager_); - //authorizer.grantRole(authorizer.getManagerRole(), manager_); - // Add necessary modules. // Note to not use the public addModule function as the factory // is (most probably) not authorized. diff --git a/src/orchestrator/base/ModuleManager.sol b/src/orchestrator/base/ModuleManager.sol index f4ab5ec3b..7bacfc5fd 100644 --- a/src/orchestrator/base/ModuleManager.sol +++ b/src/orchestrator/base/ModuleManager.sol @@ -164,7 +164,7 @@ abstract contract ModuleManager is } //-------------------------------------------------------------------------- - // onlyProposalOwner Functions + // onlyOrchestratorOwner Functions /// @inheritdoc IModuleManager function addModule(address module) diff --git a/test/e2e/BountyManagerLifecycle.t.sol b/test/e2e/BountyManagerLifecycle.t.sol index fea648caa..ee6e65608 100644 --- a/test/e2e/BountyManagerLifecycle.t.sol +++ b/test/e2e/BountyManagerLifecycle.t.sol @@ -79,7 +79,7 @@ contract BountyManagerLifecycle is E2eTest { } } - // we authorize the deployer of the proposal as the bounty admin + // we authorize the deployer of the orchestrator as the bounty admin bountyManager.grantModuleRole( uint8(IBountyManager.Roles.BountyAdmin), address(this) ); diff --git a/test/e2e/CreateNewOrchestrator.t.sol b/test/e2e/CreateNewOrchestrator.t.sol index 610e1c2a4..999a8c902 100644 --- a/test/e2e/CreateNewOrchestrator.t.sol +++ b/test/e2e/CreateNewOrchestrator.t.sol @@ -26,8 +26,9 @@ import { } from "src/modules/logicModule/MilestoneManager.sol"; import { - IMetadataManager, MetadataManager -} from "src/modules/MetadataManager.sol"; + IMetadataManager, + MetadataManager +} from "src/modules/utils/MetadataManager.sol"; //Beacon import {IBeacon, Beacon} from "src/factories/beacon/Beacon.sol"; diff --git a/test/modules/MetadataManager.t.sol b/test/modules/MetadataManager.t.sol index 2caa7a273..29f5f4ab7 100644 --- a/test/modules/MetadataManager.t.sol +++ b/test/modules/MetadataManager.t.sol @@ -14,8 +14,9 @@ import {OZErrors} from "test/utils/errors/OZErrors.sol"; // SuT import { - MetadataManager, IMetadataManager -} from "src/modules/MetadataManager.sol"; + MetadataManager, + IMetadataManager +} from "src/modules/utils/MetadataManager.sol"; contract MetadataManagerTest is ModuleTest { bool hasDependency; diff --git a/test/modules/authorizer/SingleVoteGovernor.t.sol b/test/modules/authorizer/SingleVoteGovernor.t.sol index 7eef70b79..69a48f624 100644 --- a/test/modules/authorizer/SingleVoteGovernor.t.sol +++ b/test/modules/authorizer/SingleVoteGovernor.t.sol @@ -8,7 +8,7 @@ import "forge-std/console.sol"; import { SingleVoteGovernor, ISingleVoteGovernor -} from "src/modules/authorizer/SingleVoteGovernor.sol"; +} from "src/modules/utils/SingleVoteGovernor.sol"; // External Libraries import {Clones} from "@oz/proxy/Clones.sol"; diff --git a/test/modules/base/Module.t.sol b/test/modules/base/Module.t.sol index 35da0822d..d0c94ff36 100644 --- a/test/modules/base/Module.t.sol +++ b/test/modules/base/Module.t.sol @@ -8,6 +8,9 @@ import {Clones} from "@oz/proxy/Clones.sol"; import {IERC20} from "@oz/token/ERC20/IERC20.sol"; +//Internal Dependencies +import {ModuleTest, IModule, IOrchestrator} from "test/modules/ModuleTest.sol"; + // Internal Libraries import {LibMetadata} from "src/modules/lib/LibMetadata.sol"; @@ -28,35 +31,27 @@ import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; // Errors import {OZErrors} from "test/utils/errors/OZErrors.sol"; -contract ModuleTest is Test { +contract baseModuleTest is ModuleTest { // SuT ModuleMock module; - Orchestrator orchestrator; - - // Mocks - FundingManagerMock fundingManager; - AuthorizerMock authorizer; - PaymentProcessorMock paymentProcessor; - - // Constants - uint constant MAJOR_VERSION = 1; - uint constant MINOR_VERSION = 1; - string constant URL = "https://github.com/organization/module"; - string constant TITLE = "Payment Processor"; - - IModule.Metadata METADATA = - IModule.Metadata(MAJOR_VERSION, MINOR_VERSION, URL, TITLE); + enum mockRoles { + ROLE_1, + ROLE_2, + ROLE_3, + ROLE_4, + ROLE_5 + } - bytes CONFIGDATA = bytes(""); + bytes _CONFIGDATA = bytes(""); function setUp() public { - fundingManager = new FundingManagerMock(); + /*//fundingManager = new FundingManagerMock(); - authorizer = new AuthorizerMock(); - authorizer.setAllAuthorized(true); + //_authorizer = new AuthorizerMock(); + //_authorizer.setAllAuthorized(true); - paymentProcessor = new PaymentProcessorMock(); + //paymentProcessor = new PaymentProcessorMock(); address orchestratorImpl = address(new Orchestrator()); orchestrator = Orchestrator(Clones.clone(orchestratorImpl)); @@ -64,44 +59,52 @@ contract ModuleTest is Test { address impl = address(new ModuleMock()); module = ModuleMock(Clones.clone(impl)); - module.init(orchestrator, METADATA, CONFIGDATA); + module.init(orchestrator, _METADATA, _CONFIGDATA); // Initialize orchestrator to enable module. address[] memory modules = new address[](1); modules[0] = address(module); orchestrator.init( 1, - // address(this), IERC20(new ERC20Mock("Mock", "MOCK")), modules, fundingManager, - authorizer, + _authorizer, paymentProcessor - ); + );*/ + + address impl = address(new ModuleMock()); + module = ModuleMock(Clones.clone(impl)); + + _setUpOrchestrator(module); + + _authorizer.setIsAuthorized(address(this), true); + + module.init(_orchestrator, _METADATA, _CONFIGDATA); } //-------------------------------------------------------------------------- // Tests: Initialization - function testInit() public { + function testInit() public override { // Orchestrator correctly written to storage. - assertEq(address(module.orchestrator()), address(orchestrator)); + assertEq(address(module.orchestrator()), address(_orchestrator)); // Identifier correctly computed. - assertEq(module.identifier(), LibMetadata.identifier(METADATA)); + assertEq(module.identifier(), LibMetadata.identifier(_METADATA)); // Version correctly set. uint majorVersion; uint minorVersion; (majorVersion, minorVersion) = module.version(); - assertEq(majorVersion, MAJOR_VERSION); - assertEq(minorVersion, MINOR_VERSION); + assertEq(majorVersion, _MAJOR_VERSION); + assertEq(minorVersion, _MINOR_VERSION); - // URL correctly set. - assertEq(module.url(), URL); + // _URL correctly set. + assertEq(module.url(), _URL); - // Title correctly set. - assertEq(module.title(), TITLE); + // _TITLE correctly set. + assertEq(module.title(), _TITLE); } function testInitFailsForNonInitializerFunction() public { @@ -109,12 +112,12 @@ contract ModuleTest is Test { module = ModuleMock(Clones.clone(impl)); vm.expectRevert(OZErrors.Initializable__NotInitializing); - module.initNoInitializer(orchestrator, METADATA, CONFIGDATA); + module.initNoInitializer(_orchestrator, _METADATA, _CONFIGDATA); } - function testReinitFails() public { + function testReinitFails() public override { vm.expectRevert(OZErrors.Initializable__AlreadyInitialized); - module.init(orchestrator, METADATA, CONFIGDATA); + module.init(_orchestrator, _METADATA, _CONFIGDATA); } function testInitFailsForInvalidOrchestrator() public { @@ -122,27 +125,65 @@ contract ModuleTest is Test { module = ModuleMock(Clones.clone(impl)); vm.expectRevert(IModule.Module__InvalidOrchestratorAddress.selector); - module.init(IOrchestrator(address(0)), METADATA, CONFIGDATA); + module.init(IOrchestrator(address(0)), _METADATA, _CONFIGDATA); } function testInitFailsIfMetadataInvalid() public { address impl = address(new ModuleMock()); module = ModuleMock(Clones.clone(impl)); - // Invalid if url empty. + // Invalid if _URL empty. vm.expectRevert(IModule.Module__InvalidMetadata.selector); module.init( - orchestrator, - IModule.Metadata(MAJOR_VERSION, MINOR_VERSION, "", TITLE), - CONFIGDATA + _orchestrator, + IModule.Metadata(_MAJOR_VERSION, _MINOR_VERSION, "", _TITLE), + _CONFIGDATA ); - // Invalid if title empty. + // Invalid if _TITLE empty. vm.expectRevert(IModule.Module__InvalidMetadata.selector); module.init( - orchestrator, - IModule.Metadata(MAJOR_VERSION, MINOR_VERSION, URL, ""), - CONFIGDATA + _orchestrator, + IModule.Metadata(_MAJOR_VERSION, _MINOR_VERSION, _URL, ""), + _CONFIGDATA ); } + + //-------------------------------------------------------------------------- + // Role Functions + + function testGrantModuleRole(uint8 role, address addr) public { + vm.assume(role <= uint8(type(mockRoles).max)); + vm.assume(addr != address(0)); + + vm.startPrank(address(this)); + + _authorizer.toggleModuleSelfManagement(); + + module.grantModuleRole(role, addr); + + + bytes32 roleId = _authorizer.generateRoleId(address(module), role); + bool isAuthorized = _authorizer.checkRoleMembership(roleId, addr); + assertTrue(isAuthorized); + + vm.stopPrank(); + } + + function testRevokeModuleRole(uint8 role, address addr) public { + vm.assume(role <= uint8(type(mockRoles).max)); + vm.assume(addr != address(0)); + + vm.startPrank(address(this)); + _authorizer.toggleModuleSelfManagement(); + + module.grantModuleRole(role, addr); + module.revokeModuleRole(role, addr); + + bytes32 roleId = _authorizer.generateRoleId(address(module), role); + bool isAuthorized = _authorizer.checkRoleMembership(roleId, addr); + assertFalse(isAuthorized); + + vm.stopPrank(); + } } diff --git a/test/modules/logicModule/BountyManager.t.sol b/test/modules/logicModule/BountyManager.t.sol index 450907caf..c09dacc3a 100644 --- a/test/modules/logicModule/BountyManager.t.sol +++ b/test/modules/logicModule/BountyManager.t.sol @@ -760,29 +760,6 @@ contract BountyManagerTest is ModuleTest { bountyManager.verifyClaim(0, 1); } - //-------------------------------------------------------------------------- - // Role Functions - - function testGrantModuleRole(uint8 role, address addr) public { - vm.assume(role <= uint8(type(IBountyManager.Roles).max)); - bountyManager.grantModuleRole(role, addr); - - vm.prank(address(bountyManager)); - bool isAuthorized = _authorizer.isAuthorized(role, addr); - assertTrue(isAuthorized); - } - - function testRevokeModuleRole(uint8 role, address addr) public { - vm.assume(role <= uint8(type(IBountyManager.Roles).max)); - - bountyManager.grantModuleRole(role, addr); - bountyManager.revokeModuleRole(role, addr); - - vm.prank(address(bountyManager)); - bool isAuthorized = _authorizer.isAuthorized(role, addr); - assertFalse(isAuthorized); - } - //-------------------------------------------------------------------------- // Helper diff --git a/test/modules/logicModule/RecurringPaymentManager.t.sol b/test/modules/logicModule/RecurringPaymentManager.t.sol index c667d811b..73f87a440 100644 --- a/test/modules/logicModule/RecurringPaymentManager.t.sol +++ b/test/modules/logicModule/RecurringPaymentManager.t.sol @@ -257,7 +257,7 @@ contract RecurringPaymentManagerTest is ModuleTest { //Warp to a reasonable time vm.warp(2 weeks); - //onlyProposalOwnerOrManager + //onlyOrchestratorOwnerOrManager vm.prank(address(0xBEEF)); //Not Authorized vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); @@ -362,7 +362,7 @@ contract RecurringPaymentManagerTest is ModuleTest { _orchestrator, _METADATA, abi.encode(1 weeks) ); - //onlyProposalOwnerOrManager + //onlyOrchestratorOwnerOrManager vm.prank(address(0xBEEF)); //Not Authorized vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); diff --git a/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol b/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol index 530b2da31..6a261e30b 100644 --- a/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol +++ b/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol @@ -645,7 +645,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { assertTrue(expectedSalary != 0); - vm.prank(address(this)); // stupid line, ik, but it's just here to show that onlyProposalOwner can call the next function + vm.prank(address(this)); // stupid line, ik, but it's just here to show that onlyOrchestratorOwner can call the next function paymentProcessor.removePaymentForSpecificWalletId( paymentClient, paymentReceiver1, walletId, false ); @@ -766,7 +766,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { assertTrue(salary2 != 0); - vm.prank(address(this)); // stupid line, ik, but it's just here to show that onlyProposalOwner can call the next function + vm.prank(address(this)); // stupid line, ik, but it's just here to show that onlyOrchestratorOwner can call the next function paymentProcessor.removePaymentForSpecificWalletId( paymentClient, paymentReceiver1, diff --git a/test/orchestrator/Orchestrator.t.sol b/test/orchestrator/Orchestrator.t.sol index 2ede5a617..e1dda6bcb 100644 --- a/test/orchestrator/Orchestrator.t.sol +++ b/test/orchestrator/Orchestrator.t.sol @@ -104,7 +104,7 @@ contract OrchestratorTest is Test { ); } - // Check that proposal's storage correctly initialized. + // Check that orchestrator's storage correctly initialized. assertEq(orchestrator.orchestratorId(), orchestratorId); assertEq(address(orchestrator.token()), address(token)); assertEq(address(orchestrator.authorizer()), address(authorizer)); @@ -218,14 +218,8 @@ contract OrchestratorTest is Test { // verify whether the init value is set and not the value from the old // authorizer, to check whether the replacement is successful - assertFalse( - IAuthorizer(orchestrator.authorizer()).isAuthorized(address(this)) - ); - assertTrue( - IAuthorizer(orchestrator.authorizer()).isAuthorized( - address(0xA11CE) - ) - ); + assertFalse(orchestrator.authorizer().isAuthorized(address(this))); + assertTrue(orchestrator.authorizer().isAuthorized(address(0xA11CE))); } function testSetFundingManager( diff --git a/test/utils/mocks/modules/AuthorizerMock.sol b/test/utils/mocks/modules/AuthorizerMock.sol index 20f1cfc9c..03957ee97 100644 --- a/test/utils/mocks/modules/AuthorizerMock.sol +++ b/test/utils/mocks/modules/AuthorizerMock.sol @@ -1,6 +1,8 @@ // SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.0; +import "forge-std/console.sol"; + import {Module, IModule, IOrchestrator} from "src/modules/base/Module.sol"; import {IAuthorizer} from "src/modules/authorizer/IAuthorizer.sol"; @@ -81,11 +83,12 @@ contract AuthorizerMock is IAuthorizer, Module { } function grantRoleFromModule(uint8 role, address target) external { - _roleAuthorized[generateRoleId(msg.sender, role)][target] = true; + console.log(_msgSender()); + _roleAuthorized[generateRoleId(_msgSender(), role)][target] = true; } function revokeRoleFromModule(uint8 role, address target) external { - _roleAuthorized[generateRoleId(msg.sender, role)][target] = false; + _roleAuthorized[generateRoleId(_msgSender(), role)][target] = false; } function toggleModuleSelfManagement() external {} @@ -116,6 +119,14 @@ contract AuthorizerMock is IAuthorizer, Module { return _authorized[who] || _roleAuthorized[role][who] || _allAuthorized; } + function checkRoleMembership(bytes32 role, address who) + external + view + returns (bool) + { + return _roleAuthorized[role][who]; + } + function revokeRole(bytes32 role, address who) public { _roleAuthorized[role][who] = false; } From beb6ac1002ccef807fec3bc1c716acac3f6d6f78 Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Fri, 4 Aug 2023 10:58:06 +0200 Subject: [PATCH 14/32] add singleVoteLifecycle (not finished)) --- src/modules/utils/ISingleVoteGovernor.sol | 4 + test/e2e/E2eTest.sol | 35 +++ test/e2e/SingleVoteGovernorLifecycle.sol | 250 ++++++++++++++++++ .../authorizer/SingleVoteGovernor.t.sol | 1 - 4 files changed, 289 insertions(+), 1 deletion(-) create mode 100644 test/e2e/SingleVoteGovernorLifecycle.sol diff --git a/src/modules/utils/ISingleVoteGovernor.sol b/src/modules/utils/ISingleVoteGovernor.sol index a4e28bc02..dd022a4c0 100644 --- a/src/modules/utils/ISingleVoteGovernor.sol +++ b/src/modules/utils/ISingleVoteGovernor.sol @@ -110,6 +110,10 @@ interface ISingleVoteGovernor { function isVoter(address who) external view returns (bool); + + function addVoter(address who) external; + function removeVoter(address who) external; + function motions(uint motionId) external view diff --git a/test/e2e/E2eTest.sol b/test/e2e/E2eTest.sol index 96bd34c54..a3ad252fd 100644 --- a/test/e2e/E2eTest.sol +++ b/test/e2e/E2eTest.sol @@ -27,6 +27,7 @@ import {BountyManager} from "src/modules/logicModule/BountyManager.sol"; import {RecurringPaymentManager} from "src/modules/logicModule/RecurringPaymentManager.sol"; import {RoleAuthorizer} from "src/modules/authorizer/RoleAuthorizer.sol"; +import {SingleVoteGovernor} from "src/modules/utils/SingleVoteGovernor.sol"; //Mocks import {AuthorizerMock} from "test/utils/mocks/modules/AuthorizerMock.sol"; @@ -170,6 +171,29 @@ contract E2eTest is Test { abi.encode(hasDependency, dependencies) ); + + SingleVoteGovernor singleVoteGovernorImpl; + Beacon singleVoteGovernorBeacon; + address singleVoteGovernorBeaconOwner = + makeAddr("single vote governor manager beacon owner"); + IModule.Metadata singleVoteGovernorMetadata = IModule.Metadata( + 1, + 1, + "https://github.com/inverter/single-vote-governor", + "SingleVoteGovernor" + ); + + address[] initialVoters = [makeAddr("voter1"), makeAddr("voter2"), makeAddr("voter3")]; + + IOrchestratorFactory.ModuleConfig singleVoteGovernorFactoryConfig = + IOrchestratorFactory.ModuleConfig( + singleVoteGovernorMetadata, + abi.encode(initialVoters, 2, 3 days), + abi.encode(hasDependency, dependencies) + ); + + + function setUp() public { // Deploy Orchestrator implementation. orchestratorImpl = new Orchestrator(); @@ -183,6 +207,7 @@ contract E2eTest is Test { recurringPaymentManagerImpl = new RecurringPaymentManager(); authorizerImpl = new AuthorizerMock(); roleAuthorizerImpl = new RoleAuthorizer(); + singleVoteGovernorImpl = new SingleVoteGovernor(); // Deploy module beacons. vm.prank(rebasingFundingManagerBeaconOwner); @@ -201,6 +226,8 @@ contract E2eTest is Test { authorizerBeacon = new Beacon(); vm.prank(roleAuthorizerBeaconOwner); roleAuthorizerBeacon = new Beacon(); + vm.prank(singleVoteGovernorBeaconOwner); + singleVoteGovernorBeacon = new Beacon(); // Set beacon's implementations. vm.prank(rebasingFundingManagerBeaconOwner); @@ -223,9 +250,14 @@ contract E2eTest is Test { ); vm.prank(authorizerBeaconOwner); authorizerBeacon.upgradeTo(address(authorizerImpl)); + vm.prank(roleAuthorizerBeaconOwner); roleAuthorizerBeacon.upgradeTo(address(roleAuthorizerImpl)); + vm.prank(singleVoteGovernorBeaconOwner); + singleVoteGovernorBeacon.upgradeTo(address(singleVoteGovernorImpl)); + + // Deploy Factories. moduleFactory = new ModuleFactory(); orchestratorFactory = @@ -259,6 +291,9 @@ contract E2eTest is Test { moduleFactory.registerMetadata( roleAuthorizerMetadata, IBeacon(roleAuthorizerBeacon) ); + moduleFactory.registerMetadata( + singleVoteGovernorMetadata, IBeacon(singleVoteGovernorBeacon) + ); } function _createNewOrchestratorWithAllModules( diff --git a/test/e2e/SingleVoteGovernorLifecycle.sol b/test/e2e/SingleVoteGovernorLifecycle.sol new file mode 100644 index 000000000..5c6bef38a --- /dev/null +++ b/test/e2e/SingleVoteGovernorLifecycle.sol @@ -0,0 +1,250 @@ +// SPDX-License-Identifier: LGPL-3.0-only +pragma solidity ^0.8.0; + +import {E2eTest} from "test/e2e/E2eTest.sol"; +import "forge-std/console.sol"; + +//Internal Dependencies +import {ModuleTest, IModule, IOrchestrator} from "test/modules/ModuleTest.sol"; +import {IOrchestratorFactory} from "src/factories/OrchestratorFactory.sol"; +import {RoleAuthorizer} from "src/modules/authorizer/RoleAuthorizer.sol"; + +// External Libraries +import {Clones} from "@oz/proxy/Clones.sol"; + +import {RebasingFundingManager} from + "src/modules/fundingManager/RebasingFundingManager.sol"; +// SuT +import { + BountyManager, + IBountyManager, + IERC20PaymentClient +} from "src/modules/logicModule/BountyManager.sol"; + +import {StreamingPaymentProcessor} from + "src/modules/paymentProcessor/StreamingPaymentProcessor.sol"; + +import { + IStreamingPaymentProcessor, + IERC20PaymentClient +} from "src/modules/paymentProcessor/IStreamingPaymentProcessor.sol"; + +import {SingleVoteGovernor, ISingleVoteGovernor} from "src/modules/utils/SingleVoteGovernor.sol"; + +// Mocks +import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; + +contract SingleVoteGovernorLifecycle is E2eTest { + + // voters + address voter1 = makeAddr("voter1"); + address voter2 = makeAddr("voter2"); + address voter3 = makeAddr("voter3"); + + // Constants + ERC20Mock token = new ERC20Mock("Mock", "MOCK"); + + function test_e2e_SingleVoteGovernorLifecycle() public { + + // Setup new orchestrator + // add voters + // create vote to create bounty + // pass that vote + // execute it + // check that the bounty was created + + + // -----------INIT + // address(this) creates a new orchestrator. + IOrchestratorFactory.OrchestratorConfig memory orchestratorConfig = + IOrchestratorFactory.OrchestratorConfig({ + owner: address(this), + token: token + }); + + IOrchestrator orchestrator = + _createNewOrchestratorWithAllModules_withBountyManagerAndSingleVoteGovernor( + orchestratorConfig + ); + + RebasingFundingManager fundingManager = + RebasingFundingManager(address(orchestrator.fundingManager())); + + RoleAuthorizer authorizer = RoleAuthorizer( + address(orchestrator.authorizer()) + ); + + + + // Find BountyManager + BountyManager bountyManager; + + address[] memory modulesList = orchestrator.listModules(); + for (uint i; i < modulesList.length; ++i) { + try IBountyManager(modulesList[i]).isExistingBountyId(0) returns ( + bool + ) { + bountyManager = BountyManager(modulesList[i]); + break; + } catch { + continue; + } + } + + // Find SingleVoteGovernor + SingleVoteGovernor singleVoteGovernor; + + for (uint i; i < modulesList.length; ++i) { + try ISingleVoteGovernor(modulesList[i]).isVoter(address(0)) returns ( + bool + ) { + singleVoteGovernor = SingleVoteGovernor(modulesList[i]); + break; + } catch { + continue; + } + } + + + // We make the governor the only owner + bytes32 ownerRole = authorizer.getOwnerRole(); + authorizer.grantRole(ownerRole, address(singleVoteGovernor)); + + authorizer.renounceRole(ownerRole, address(this)); + + + // Funders deposit funds + + // IMPORTANT + // ========= + // Due to how the underlying rebase mechanism works, it is necessary + // to always have some amount of tokens in the orchestrator. + // It's best, if the owner deposits them right after deployment. + uint initialDeposit = 10e18; + token.mint(address(this), initialDeposit); + token.approve(address(fundingManager), initialDeposit); + fundingManager.deposit(initialDeposit); + + // Seeing this great working on the orchestrator, funder1 decides to fund + // the orchestrator with 1k of tokens. + address funder1 = makeAddr("funder1"); + + token.mint(funder1, 1000e18); + + vm.startPrank(funder1); + { + token.approve(address(fundingManager), 1000e18); + fundingManager.deposit(1000e18); + } + vm.stopPrank(); + + + + + // Bounty details + uint minimumPayoutAmount = 100e18; + uint maximumPayoutAmount = 500e18; + bytes memory details = "This is a test bounty"; + + + // voter 1 sets up vote to create bounty + vm.prank(voter1); + uint motionId= singleVoteGovernor.createMotion(address(bountyManager), abi.encodeWithSignature( + "addBounty(uint,uint,bytes memory)", + minimumPayoutAmount, + maximumPayoutAmount, + details + )); + + vm.warp(block.timestamp + 2); + + // voters vote + vm.prank(voter1); + singleVoteGovernor.castVote(motionId, 0); + vm.prank(voter2); + singleVoteGovernor.castVote(motionId, 0); + vm.prank(voter3); + singleVoteGovernor.castVote(motionId, 0); + + + vm.warp(block.timestamp + 3 days); + + // execute vote + singleVoteGovernor.executeMotion(motionId); + + vm.warp(block.timestamp + 2); + + console.log(bountyManager.listBountyIds()[0]); + + // check that the bounty was created + IBountyManager.Bounty memory bounty = bountyManager.getBountyInformation(2); + assertEq(bounty.minimumPayoutAmount, minimumPayoutAmount); + assertEq(bounty.maximumPayoutAmount, maximumPayoutAmount); + assertEq(bounty.details, details); + + +/* + + // Workers submit bounty + IBountyManager.Contributor memory contrib1 = + IBountyManager.Contributor(address(0xA11CE), 150e18); + IBountyManager.Contributor memory contrib2 = + IBountyManager.Contributor(address(0xb0b), 150e18); + + //auth.setIsAuthorized(address(0xA11CE), true); + bountyManager.grantModuleRole( + uint8(IBountyManager.Roles.ClaimAdmin), address(0xA11CE) + ); + + IBountyManager.Contributor[] memory contribs = + new IBountyManager.Contributor[](2); + contribs[0] = contrib1; + contribs[1] = contrib2; + + bytes memory claimDetails = "This is a test submission"; + + vm.prank(contrib1.addr); + uint claimId = bountyManager.addClaim(1, contribs, claimDetails); + + // Verifiers approve bounty + + address verifier1 = makeAddr("verifier 1"); + + //auth.setIsAuthorized(verifier1, true); + bountyManager.grantModuleRole( + uint8(IBountyManager.Roles.VerifyAdmin), verifier1 + ); + + vm.prank(verifier1); + bountyManager.verifyClaim(claimId, bountyId); + + // Bounty has been paid out + assertEq(token.balanceOf(contrib1.addr), 150e18); + assertEq(token.balanceOf(contrib2.addr), 150e18);*/ + } + + function _createNewOrchestratorWithAllModules_withBountyManagerAndSingleVoteGovernor( + IOrchestratorFactory.OrchestratorConfig memory config + ) internal returns (IOrchestrator) { + IOrchestratorFactory.ModuleConfig[] memory optionalModules = + new IOrchestratorFactory.ModuleConfig[](2); + optionalModules[0] = singleVoteGovernorFactoryConfig; + optionalModules[1] = bountyManagerFactoryConfig; + + IOrchestratorFactory.ModuleConfig memory + rebasingFundingManagerFactoryConfig = IOrchestratorFactory + .ModuleConfig( + rebasingFundingManagerMetadata, + abi.encode(address(config.token)), + abi.encode(hasDependency, dependencies) + ); + + return orchestratorFactory.createOrchestrator( + config, + rebasingFundingManagerFactoryConfig, + roleAuthorizerFactoryConfig, + paymentProcessorFactoryConfig, + optionalModules + ); + } +} diff --git a/test/modules/authorizer/SingleVoteGovernor.t.sol b/test/modules/authorizer/SingleVoteGovernor.t.sol index 69a48f624..1b9a5daa5 100644 --- a/test/modules/authorizer/SingleVoteGovernor.t.sol +++ b/test/modules/authorizer/SingleVoteGovernor.t.sol @@ -933,7 +933,6 @@ contract SingleVoteGovernorTest is ModuleTest { uint _newDuration = 3 days; bytes memory _encodedAction = abi.encodeWithSignature("setVotingDuration(uint256)", _newDuration); - uint _voteID = speedrunSuccessfulVote( address(_governor), _encodedAction, initialVoters ); From 0d13db6e6747a8b2a68cfa818ef7c79d3ce6bef8 Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Fri, 4 Aug 2023 11:29:59 +0200 Subject: [PATCH 15/32] finish e2e --- src/modules/utils/ISingleVoteGovernor.sol | 1 - test/e2e/E2eTest.sol | 7 +- test/e2e/SingleVoteGovernorLifecycle.sol | 130 +++++++++------------- test/modules/base/Module.t.sol | 1 - 4 files changed, 55 insertions(+), 84 deletions(-) diff --git a/src/modules/utils/ISingleVoteGovernor.sol b/src/modules/utils/ISingleVoteGovernor.sol index dd022a4c0..72df5e48c 100644 --- a/src/modules/utils/ISingleVoteGovernor.sol +++ b/src/modules/utils/ISingleVoteGovernor.sol @@ -110,7 +110,6 @@ interface ISingleVoteGovernor { function isVoter(address who) external view returns (bool); - function addVoter(address who) external; function removeVoter(address who) external; diff --git a/test/e2e/E2eTest.sol b/test/e2e/E2eTest.sol index a3ad252fd..d65e64973 100644 --- a/test/e2e/E2eTest.sol +++ b/test/e2e/E2eTest.sol @@ -171,7 +171,6 @@ contract E2eTest is Test { abi.encode(hasDependency, dependencies) ); - SingleVoteGovernor singleVoteGovernorImpl; Beacon singleVoteGovernorBeacon; address singleVoteGovernorBeaconOwner = @@ -183,7 +182,8 @@ contract E2eTest is Test { "SingleVoteGovernor" ); - address[] initialVoters = [makeAddr("voter1"), makeAddr("voter2"), makeAddr("voter3")]; + address[] initialVoters = + [makeAddr("voter1"), makeAddr("voter2"), makeAddr("voter3")]; IOrchestratorFactory.ModuleConfig singleVoteGovernorFactoryConfig = IOrchestratorFactory.ModuleConfig( @@ -192,8 +192,6 @@ contract E2eTest is Test { abi.encode(hasDependency, dependencies) ); - - function setUp() public { // Deploy Orchestrator implementation. orchestratorImpl = new Orchestrator(); @@ -257,7 +255,6 @@ contract E2eTest is Test { vm.prank(singleVoteGovernorBeaconOwner); singleVoteGovernorBeacon.upgradeTo(address(singleVoteGovernorImpl)); - // Deploy Factories. moduleFactory = new ModuleFactory(); orchestratorFactory = diff --git a/test/e2e/SingleVoteGovernorLifecycle.sol b/test/e2e/SingleVoteGovernorLifecycle.sol index 5c6bef38a..98a313ff5 100644 --- a/test/e2e/SingleVoteGovernorLifecycle.sol +++ b/test/e2e/SingleVoteGovernorLifecycle.sol @@ -29,13 +29,15 @@ import { IERC20PaymentClient } from "src/modules/paymentProcessor/IStreamingPaymentProcessor.sol"; -import {SingleVoteGovernor, ISingleVoteGovernor} from "src/modules/utils/SingleVoteGovernor.sol"; +import { + SingleVoteGovernor, + ISingleVoteGovernor +} from "src/modules/utils/SingleVoteGovernor.sol"; // Mocks import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; contract SingleVoteGovernorLifecycle is E2eTest { - // voters address voter1 = makeAddr("voter1"); address voter2 = makeAddr("voter2"); @@ -45,15 +47,6 @@ contract SingleVoteGovernorLifecycle is E2eTest { ERC20Mock token = new ERC20Mock("Mock", "MOCK"); function test_e2e_SingleVoteGovernorLifecycle() public { - - // Setup new orchestrator - // add voters - // create vote to create bounty - // pass that vote - // execute it - // check that the bounty was created - - // -----------INIT // address(this) creates a new orchestrator. IOrchestratorFactory.OrchestratorConfig memory orchestratorConfig = @@ -70,14 +63,11 @@ contract SingleVoteGovernorLifecycle is E2eTest { RebasingFundingManager fundingManager = RebasingFundingManager(address(orchestrator.fundingManager())); - RoleAuthorizer authorizer = RoleAuthorizer( - address(orchestrator.authorizer()) - ); - - + RoleAuthorizer authorizer = + RoleAuthorizer(address(orchestrator.authorizer())); // Find BountyManager - BountyManager bountyManager; + BountyManager bountyManager; address[] memory modulesList = orchestrator.listModules(); for (uint i; i < modulesList.length; ++i) { @@ -93,11 +83,10 @@ contract SingleVoteGovernorLifecycle is E2eTest { // Find SingleVoteGovernor SingleVoteGovernor singleVoteGovernor; - + for (uint i; i < modulesList.length; ++i) { - try ISingleVoteGovernor(modulesList[i]).isVoter(address(0)) returns ( - bool - ) { + try ISingleVoteGovernor(modulesList[i]).isVoter(address(0)) + returns (bool) { singleVoteGovernor = SingleVoteGovernor(modulesList[i]); break; } catch { @@ -105,13 +94,14 @@ contract SingleVoteGovernorLifecycle is E2eTest { } } - // We make the governor the only owner bytes32 ownerRole = authorizer.getOwnerRole(); authorizer.grantRole(ownerRole, address(singleVoteGovernor)); - authorizer.renounceRole(ownerRole, address(this)); + // we authorize governance to create bounties + bountyManager.grantModuleRole(uint8(0), address(singleVoteGovernor)); + authorizer.renounceRole(ownerRole, address(this)); // Funders deposit funds @@ -138,89 +128,75 @@ contract SingleVoteGovernorLifecycle is E2eTest { } vm.stopPrank(); - - - // Bounty details uint minimumPayoutAmount = 100e18; uint maximumPayoutAmount = 500e18; bytes memory details = "This is a test bounty"; - // voter 1 sets up vote to create bounty vm.prank(voter1); - uint motionId= singleVoteGovernor.createMotion(address(bountyManager), abi.encodeWithSignature( - "addBounty(uint,uint,bytes memory)", - minimumPayoutAmount, - maximumPayoutAmount, - details - )); + uint motionId = singleVoteGovernor.createMotion( + address(bountyManager), + abi.encodeWithSelector( + IBountyManager.addBounty.selector, + minimumPayoutAmount, + maximumPayoutAmount, + details + ) + ); vm.warp(block.timestamp + 2); // voters vote - vm.prank(voter1); + vm.prank(voter1); singleVoteGovernor.castVote(motionId, 0); vm.prank(voter2); singleVoteGovernor.castVote(motionId, 0); vm.prank(voter3); singleVoteGovernor.castVote(motionId, 0); - vm.warp(block.timestamp + 3 days); // execute vote + vm.prank(voter1); singleVoteGovernor.executeMotion(motionId); - vm.warp(block.timestamp + 2); + // to avoid stack too deep + (bool _excRes, bytes memory _excData) = + _getMotionExecutionResult(singleVoteGovernor, motionId); - console.log(bountyManager.listBountyIds()[0]); + console.log(_excRes); + console.log(string(_excData)); + + vm.warp(block.timestamp + 2); // check that the bounty was created - IBountyManager.Bounty memory bounty = bountyManager.getBountyInformation(2); + IBountyManager.Bounty memory bounty = + bountyManager.getBountyInformation(1); assertEq(bounty.minimumPayoutAmount, minimumPayoutAmount); assertEq(bounty.maximumPayoutAmount, maximumPayoutAmount); assertEq(bounty.details, details); + } - -/* - - // Workers submit bounty - IBountyManager.Contributor memory contrib1 = - IBountyManager.Contributor(address(0xA11CE), 150e18); - IBountyManager.Contributor memory contrib2 = - IBountyManager.Contributor(address(0xb0b), 150e18); - - //auth.setIsAuthorized(address(0xA11CE), true); - bountyManager.grantModuleRole( - uint8(IBountyManager.Roles.ClaimAdmin), address(0xA11CE) - ); - - IBountyManager.Contributor[] memory contribs = - new IBountyManager.Contributor[](2); - contribs[0] = contrib1; - contribs[1] = contrib2; - - bytes memory claimDetails = "This is a test submission"; - - vm.prank(contrib1.addr); - uint claimId = bountyManager.addClaim(1, contribs, claimDetails); - - // Verifiers approve bounty - - address verifier1 = makeAddr("verifier 1"); - - //auth.setIsAuthorized(verifier1, true); - bountyManager.grantModuleRole( - uint8(IBountyManager.Roles.VerifyAdmin), verifier1 - ); - - vm.prank(verifier1); - bountyManager.verifyClaim(claimId, bountyId); - - // Bounty has been paid out - assertEq(token.balanceOf(contrib1.addr), 150e18); - assertEq(token.balanceOf(contrib2.addr), 150e18);*/ + function _getMotionExecutionResult( + SingleVoteGovernor singleVoteGovernor, + uint motionId + ) internal returns (bool, bytes memory) { + ( + address _addr, + bytes memory _act, + uint _start, + uint _end, + uint _threshold, + uint _for, + uint _against, + uint _abstain, + uint _excAt, + bool _excRes, + bytes memory _excData + ) = singleVoteGovernor.motions(motionId); + + return (_excRes, _excData); } function _createNewOrchestratorWithAllModules_withBountyManagerAndSingleVoteGovernor( diff --git a/test/modules/base/Module.t.sol b/test/modules/base/Module.t.sol index d0c94ff36..93e6c266d 100644 --- a/test/modules/base/Module.t.sol +++ b/test/modules/base/Module.t.sol @@ -162,7 +162,6 @@ contract baseModuleTest is ModuleTest { module.grantModuleRole(role, addr); - bytes32 roleId = _authorizer.generateRoleId(address(module), role); bool isAuthorized = _authorizer.checkRoleMembership(roleId, addr); assertTrue(isAuthorized); From 4f50b53f9bf26acc7ce47aff2eb20f0da410b96d Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Fri, 4 Aug 2023 11:57:17 +0200 Subject: [PATCH 16/32] fix scripts --- Makefile | 2 +- script/modules/{governance => }/DeploySingleVoteGovernor.s.sol | 0 script/setup/SetupToyOrchestratorScript.s.sol | 3 +-- 3 files changed, 2 insertions(+), 3 deletions(-) rename script/modules/{governance => }/DeploySingleVoteGovernor.s.sol (100%) diff --git a/Makefile b/Makefile index daad18a33..914b36349 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ testScripts: ## Run e2e test suite @forge script script/factories/DeployOrchestratorFactory.s.sol @forge script script/modules/governance/DeployRoleAuthorizer.s.sol - @forge script script/modules/governance/DeploySingleVoteGovernor.s.sol + @forge script script/modules/DeploySingleVoteGovernor.s.sol @forge script script/modules/paymentProcessor/DeploySimplePaymentProcessor.s.sol @forge script script/modules/paymentProcessor/DeployStreamingPaymentProcessor.s.sol diff --git a/script/modules/governance/DeploySingleVoteGovernor.s.sol b/script/modules/DeploySingleVoteGovernor.s.sol similarity index 100% rename from script/modules/governance/DeploySingleVoteGovernor.s.sol rename to script/modules/DeploySingleVoteGovernor.s.sol diff --git a/script/setup/SetupToyOrchestratorScript.s.sol b/script/setup/SetupToyOrchestratorScript.s.sol index 15005819f..ac81c4e94 100644 --- a/script/setup/SetupToyOrchestratorScript.s.sol +++ b/script/setup/SetupToyOrchestratorScript.s.sol @@ -89,11 +89,10 @@ contract SetupToyOrchestratorScript is Test, DeploymentScript { ); // Authorizer: Metadata, initial authorized addresses - initialAuthorizedAddresses.push(orchestratorOwner); IOrchestratorFactory.ModuleConfig memory authorizerFactoryConfig = IOrchestratorFactory.ModuleConfig( authorizerMetadata, - abi.encode(initialAuthorizedAddresses), + abi.encode(orchestratorOwner, orchestratorOwner), abi.encode(hasDependency, dependencies) ); From ae49d488c5332f4ec2f4eda794915c3725692839 Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Fri, 4 Aug 2023 12:16:36 +0200 Subject: [PATCH 17/32] update lcov --- lcov.info | 2899 ++++++++++++++++++++++++++--------------------------- 1 file changed, 1434 insertions(+), 1465 deletions(-) diff --git a/lcov.info b/lcov.info index 6ebe177b1..4b6d6ae80 100644 --- a/lcov.info +++ b/lcov.info @@ -98,9 +98,9 @@ BRF:0 BRH:0 end_of_record TN: -SF:script/modules/governance/DeployRoleAuthorizer.s.sol -FN:24,DeployRoleAuthorizer.run -FNDA:0,DeployRoleAuthorizer.run +SF:script/modules/DeploySingleVoteGovernor.s.sol +FN:24,DeploySingleVoteGovernor.run +FNDA:0,DeploySingleVoteGovernor.run DA:25,0 DA:29,0 DA:32,0 @@ -114,9 +114,9 @@ BRF:0 BRH:0 end_of_record TN: -SF:script/modules/governance/DeploySingleVoteGovernor.s.sol -FN:24,DeploySingleVoteGovernor.run -FNDA:0,DeploySingleVoteGovernor.run +SF:script/modules/governance/DeployRoleAuthorizer.s.sol +FN:24,DeployRoleAuthorizer.run +FNDA:0,DeployRoleAuthorizer.run DA:25,0 DA:29,0 DA:32,0 @@ -228,67 +228,66 @@ DA:84,0 DA:85,0 DA:92,0 DA:93,0 -DA:94,0 +DA:100,0 DA:101,0 -DA:102,0 +DA:108,0 DA:109,0 DA:110,0 -DA:111,0 -DA:116,0 -DA:118,0 -DA:127,0 -DA:131,0 -BRDA:131,0,0,- -BRDA:131,0,1,- +DA:115,0 +DA:117,0 +DA:126,0 +DA:130,0 +BRDA:130,0,0,- +BRDA:130,0,1,- +DA:132,0 DA:133,0 DA:134,0 -DA:135,0 +DA:141,0 DA:142,0 DA:143,0 DA:144,0 -DA:145,0 +DA:146,0 DA:147,0 -DA:148,0 +DA:156,0 DA:157,0 -DA:158,0 -DA:160,0 -DA:164,0 -DA:170,0 +DA:159,0 +DA:163,0 +DA:169,0 +DA:175,0 DA:176,0 -DA:177,0 -DA:180,0 +DA:179,0 +DA:194,0 DA:195,0 DA:196,0 -DA:197,0 -DA:199,0 -DA:201,0 -DA:203,0 -DA:205,0 +DA:198,0 +DA:200,0 +DA:202,0 +DA:204,0 +DA:206,0 DA:207,0 -DA:208,0 -DA:211,0 +DA:210,0 +DA:212,0 DA:213,0 DA:214,0 -DA:215,0 +DA:216,0 DA:217,0 -DA:218,0 +DA:222,0 DA:223,0 -DA:224,0 -DA:226,0 -DA:228,0 -DA:235,0 +DA:225,0 +DA:227,0 +DA:234,0 +DA:241,0 DA:242,0 -DA:243,0 -DA:248,0 -DA:251,0 -DA:253,0 -DA:256,0 -DA:260,0 -DA:263,0 -DA:265,0 +DA:247,0 +DA:250,0 +DA:252,0 +DA:255,0 +DA:259,0 +DA:262,0 +DA:264,0 FNF:1 FNH:0 -LF:68 +LF:67 LH:0 BRF:2 BRH:0 @@ -374,24 +373,24 @@ end_of_record TN: SF:src/factories/ModuleFactory.sol FN:76,ModuleFactory.createModule -FNDA:2074,ModuleFactory.createModule -DA:84,2074 -DA:85,2074 -DA:87,2074 +FNDA:2079,ModuleFactory.createModule +DA:84,2079 +DA:85,2079 +DA:87,2079 BRDA:87,0,0,256 -BRDA:87,0,1,1818 +BRDA:87,0,1,1823 DA:88,256 -DA:101,1818 +DA:101,1823 BRDA:101,1,0,256 -BRDA:101,1,1,1562 -DA:103,1562 -DA:105,1562 -DA:107,1562 -DA:111,1562 +BRDA:101,1,1,1567 +DA:103,1567 +DA:105,1567 +DA:107,1567 +DA:111,1567 FN:118,ModuleFactory.getBeaconAndId FNDA:256,ModuleFactory.getBeaconAndId -DA:123,3357 -DA:125,3357 +DA:123,3362 +DA:125,3362 FN:132,ModuleFactory.registerMetadata FNDA:1286,ModuleFactory.registerMetadata DA:138,1027 @@ -413,51 +412,51 @@ end_of_record TN: SF:src/factories/OrchestratorFactory.sol FN:73,OrchestratorFactory.createOrchestrator -FNDA:13139,OrchestratorFactory.createOrchestrator -DA:80,13139 -DA:83,13139 -DA:86,13139 -DA:93,13139 -DA:100,13139 -DA:107,13139 -DA:108,13139 -DA:109,13139 -DA:110,12183 -DA:117,13139 +FNDA:13360,OrchestratorFactory.createOrchestrator +DA:80,13360 +DA:83,13360 +DA:86,13360 +DA:93,13360 +DA:100,13360 +DA:107,13360 +DA:108,13360 +DA:109,13360 +DA:110,11819 +DA:117,13360 BRDA:117,0,0,- -BRDA:117,0,1,13139 +BRDA:117,0,1,13360 DA:118,0 -DA:122,13139 -DA:135,13139 -DA:136,12183 -BRDA:136,1,0,- -BRDA:136,1,1,3 -DA:137,3 -DA:144,13139 -BRDA:144,2,0,- -BRDA:144,2,1,- -DA:145,0 -DA:149,13139 -BRDA:149,3,0,- -BRDA:149,3,1,- -DA:150,0 -DA:154,13139 -BRDA:154,4,0,- -BRDA:154,4,1,- -DA:156,0 -DA:161,13139 -FN:165,OrchestratorFactory.getOrchestratorByID -FNDA:6660,OrchestratorFactory.getOrchestratorByID -DA:171,6440 -FN:174,OrchestratorFactory.getOrchestratorIDCounter +DA:122,13360 +DA:134,13360 +DA:135,11819 +BRDA:135,1,0,- +BRDA:135,1,1,4 +DA:136,4 +DA:143,13360 +BRDA:143,2,0,- +BRDA:143,2,1,- +DA:144,0 +DA:148,13360 +BRDA:148,3,0,- +BRDA:148,3,1,- +DA:149,0 +DA:153,13360 +BRDA:153,4,0,- +BRDA:153,4,1,- +DA:155,0 +DA:160,13360 +FN:164,OrchestratorFactory.getOrchestratorByID +FNDA:6455,OrchestratorFactory.getOrchestratorByID +DA:170,6227 +FN:173,OrchestratorFactory.getOrchestratorIDCounter FNDA:256,OrchestratorFactory.getOrchestratorIDCounter -DA:175,256 -FN:178,OrchestratorFactory.decoder -FNDA:103200,OrchestratorFactory.decoder -DA:183,103200 -FN:186,OrchestratorFactory._dependencyInjectionRequired -FNDA:51600,OrchestratorFactory._dependencyInjectionRequired -DA:191,51600 +DA:174,256 +FN:177,OrchestratorFactory.decoder +FNDA:103798,OrchestratorFactory.decoder +DA:182,103798 +FN:185,OrchestratorFactory._dependencyInjectionRequired +FNDA:51899,OrchestratorFactory._dependencyInjectionRequired +DA:190,51899 FNF:5 FNH:5 LF:26 @@ -468,8 +467,8 @@ end_of_record TN: SF:src/factories/beacon/Beacon.sol FN:40,Beacon.implementation -FNDA:10890,Beacon.implementation -DA:41,10890 +FNDA:12472,Beacon.implementation +DA:41,12472 FN:51,Beacon.upgradeTo FNDA:260,Beacon.upgradeTo DA:52,4 @@ -484,10 +483,9 @@ DA:64,3 FN:71,Beacon.supportsInterface FNDA:1,Beacon.supportsInterface DA:78,1 -DA:79,0 FNF:4 FNH:4 -LF:8 +LF:7 LH:7 BRF:2 BRH:2 @@ -495,8 +493,8 @@ end_of_record TN: SF:src/factories/beacon/BeaconProxy.sol FN:41,BeaconProxy._implementation -FNDA:12140,BeaconProxy._implementation -DA:42,12140 +FNDA:13717,BeaconProxy._implementation +DA:42,13717 FNF:1 FNH:1 LF:1 @@ -505,324 +503,122 @@ BRF:0 BRH:0 end_of_record TN: -SF:src/modules/utils/MetadataManager.sol -FN:23,MetadataManager.init -FNDA:3,MetadataManager.init -DA:28,2 -DA:30,2 -DA:34,2 -DA:39,2 -DA:41,2 -DA:43,2 -FN:49,MetadataManager.getManagerMetadata -FNDA:7,MetadataManager.getManagerMetadata -DA:54,7 -FN:57,MetadataManager.getOrchestratorMetadata -FNDA:19,MetadataManager.getOrchestratorMetadata -DA:62,19 -FN:65,MetadataManager.getTeamMetadata -FNDA:6,MetadataManager.getTeamMetadata -DA:70,6 -FN:76,MetadataManager.setManagerMetadata -FNDA:1,MetadataManager.setManagerMetadata -DA:80,1 -FN:83,MetadataManager._setManagerMetadata -FNDA:3,MetadataManager._setManagerMetadata -DA:86,3 -DA:87,3 -FN:94,MetadataManager.setOrchestratorMetadata -FNDA:1,MetadataManager.setOrchestratorMetadata -DA:97,1 -FN:100,MetadataManager._setOrchestratorMetadata -FNDA:3,MetadataManager._setOrchestratorMetadata -DA:103,3 -DA:104,3 -FN:113,MetadataManager.setTeamMetadata -FNDA:1,MetadataManager.setTeamMetadata -DA:117,1 -FN:120,MetadataManager._setTeamMetadata -FNDA:3,MetadataManager._setTeamMetadata -DA:121,3 -DA:123,3 -DA:124,3 -DA:125,4 -DA:128,3 -FNF:10 -FNH:10 -LF:21 -LH:21 -BRF:0 -BRH:0 -end_of_record -TN: SF:src/modules/authorizer/RoleAuthorizer.sol -FN:77,RoleAuthorizer.init -FNDA:520,RoleAuthorizer.init -DA:82,518 -DA:84,518 -DA:85,518 -DA:87,518 -FN:90,RoleAuthorizer.__RoleAuthorizer_init -FNDA:518,RoleAuthorizer.__RoleAuthorizer_init -DA:99,518 -DA:101,518 -DA:107,518 -DA:109,518 -DA:113,518 -BRDA:113,0,0,2 -BRDA:113,0,1,516 -DA:114,2 -DA:116,516 -DA:121,518 -DA:123,518 -FN:132,RoleAuthorizer._revokeRole -FNDA:5244,RoleAuthorizer._revokeRole -DA:138,5242 -FN:148,RoleAuthorizer.isAuthorized -FNDA:58,RoleAuthorizer.isAuthorized -DA:150,58 -FN:154,RoleAuthorizer.isAuthorized -FNDA:1039,RoleAuthorizer.isAuthorized -DA:161,1039 -DA:164,1039 -BRDA:164,1,0,7 -BRDA:164,1,1,1032 -DA:165,7 -DA:167,1032 -DA:169,1039 -FN:173,RoleAuthorizer.generateRoleId -FNDA:2648,RoleAuthorizer.generateRoleId -DA:179,35929 -FN:185,RoleAuthorizer.toggleModuleSelfManagement -FNDA:50,RoleAuthorizer.toggleModuleSelfManagement -DA:186,50 -BRDA:186,2,0,11 -BRDA:186,2,1,39 -DA:187,11 +FN:76,RoleAuthorizer.init +FNDA:521,RoleAuthorizer.init +DA:81,519 +DA:83,519 +DA:84,519 +DA:86,519 +FN:89,RoleAuthorizer.__RoleAuthorizer_init +FNDA:519,RoleAuthorizer.__RoleAuthorizer_init +DA:98,519 +DA:100,519 +DA:104,519 +DA:109,519 +DA:111,519 +DA:115,519 +DA:117,519 +DA:121,519 +BRDA:121,0,0,517 +BRDA:121,0,1,519 +DA:122,517 +DA:123,517 +FN:133,RoleAuthorizer._revokeRole +FNDA:5491,RoleAuthorizer._revokeRole +DA:139,5489 +FN:149,RoleAuthorizer.isAuthorized +FNDA:55,RoleAuthorizer.isAuthorized +DA:151,55 +FN:155,RoleAuthorizer.isAuthorized +FNDA:1040,RoleAuthorizer.isAuthorized +DA:162,1040 +DA:165,1040 +BRDA:165,1,0,8 +BRDA:165,1,1,1032 +DA:166,8 +DA:168,1032 +DA:170,1040 +FN:174,RoleAuthorizer.generateRoleId +FNDA:2656,RoleAuthorizer.generateRoleId +DA:180,34867 +FN:186,RoleAuthorizer.toggleModuleSelfManagement +FNDA:51,RoleAuthorizer.toggleModuleSelfManagement +DA:187,51 +BRDA:187,2,0,11 +BRDA:187,2,1,40 DA:188,11 -DA:190,39 -DA:191,39 -FN:196,RoleAuthorizer.grantRoleFromModule -FNDA:29,RoleAuthorizer.grantRoleFromModule -DA:201,19 -DA:202,19 -FN:206,RoleAuthorizer.revokeRoleFromModule +DA:189,11 +DA:191,40 +DA:192,40 +FN:197,RoleAuthorizer.grantRoleFromModule +FNDA:30,RoleAuthorizer.grantRoleFromModule +DA:202,20 +DA:203,20 +FN:207,RoleAuthorizer.revokeRoleFromModule FNDA:9,RoleAuthorizer.revokeRoleFromModule -DA:211,7 DA:212,7 -FN:216,RoleAuthorizer.transferAdminRole +DA:213,7 +FN:217,RoleAuthorizer.transferAdminRole FNDA:4,RoleAuthorizer.transferAdminRole -DA:220,2 -FN:224,RoleAuthorizer.burnAdminRole +DA:221,2 +FN:225,RoleAuthorizer.burnAdminRole FNDA:38,RoleAuthorizer.burnAdminRole -DA:229,38 DA:230,38 -FNF:11 -FNH:11 -LF:33 -LH:33 +DA:231,38 +FN:235,RoleAuthorizer.grantGlobalRole +FNDA:8,RoleAuthorizer.grantGlobalRole +DA:239,6 +DA:240,6 +FN:244,RoleAuthorizer.revokeGlobalRole +FNDA:4,RoleAuthorizer.revokeGlobalRole +DA:248,2 +DA:249,2 +FN:253,RoleAuthorizer.getOwnerRole +FNDA:11851,RoleAuthorizer.getOwnerRole +DA:254,11851 +FN:258,RoleAuthorizer.getManagerRole +FNDA:0,RoleAuthorizer.getManagerRole +DA:259,0 +FNF:15 +FNH:14 +LF:40 +LH:39 BRF:6 BRH:6 end_of_record TN: -SF:src/modules/utils/SingleVoteGovernor.sol -FN:75,SingleVoteGovernor.init -FNDA:517,SingleVoteGovernor.init -DA:80,516 -DA:84,516 -DA:85,516 -DA:86,516 -DA:87,516 -DA:90,516 -DA:93,516 -BRDA:93,0,0,1 -BRDA:93,0,1,515 -DA:94,1 -DA:99,515 -BRDA:99,1,0,- -BRDA:99,1,1,515 -DA:100,0 -DA:105,515 -DA:106,515 -BRDA:104,2,0,- -BRDA:104,2,1,515 -DA:108,0 -DA:112,515 -DA:113,515 -DA:114,6996 -DA:117,6996 -DA:118,6994 -BRDA:116,3,0,3 -BRDA:116,3,1,6993 -DA:120,3 -DA:123,6993 -BRDA:123,4,0,256 -BRDA:123,4,1,6737 -DA:124,256 -DA:127,6737 -DA:128,6737 -DA:132,256 -DA:135,256 -DA:136,256 -DA:139,256 -DA:140,256 -FN:147,SingleVoteGovernor.isAuthorized -FNDA:257,SingleVoteGovernor.isAuthorized -DA:154,257 -FN:160,SingleVoteGovernor.getReceipt -FNDA:42071,SingleVoteGovernor.getReceipt -DA:165,42071 -DA:167,42071 -FN:173,SingleVoteGovernor.setThreshold -FNDA:4916,SingleVoteGovernor.setThreshold -DA:175,259 -BRDA:175,5,0,256 -BRDA:175,5,1,3 -DA:176,256 -DA:182,3 -DA:183,3 -FN:186,SingleVoteGovernor.setVotingDuration -FNDA:4625,SingleVoteGovernor.setVotingDuration -DA:189,6 -DA:190,5 -BRDA:188,6,0,2 -BRDA:188,6,1,4 -DA:192,2 -DA:195,4 -DA:196,4 -FN:202,SingleVoteGovernor.addVoter -FNDA:61428,SingleVoteGovernor.addVoter -DA:203,56763 -BRDA:203,7,0,51788 -BRDA:203,7,1,56763 -DA:204,51788 -DA:206,51788 -DA:208,51788 -FN:212,SingleVoteGovernor.removeVoter -FNDA:14413,SingleVoteGovernor.removeVoter -DA:214,9617 -BRDA:214,8,0,1 -BRDA:214,8,1,9616 -DA:215,1 -DA:219,9616 -BRDA:219,9,0,1 -BRDA:219,9,1,9615 -DA:220,1 -DA:223,9615 -BRDA:223,10,0,4809 -BRDA:223,10,1,9615 -DA:224,4809 -DA:226,4809 -DA:228,4809 -FN:235,SingleVoteGovernor.createMotion -FNDA:59286,SingleVoteGovernor.createMotion -DA:241,54150 -DA:245,54150 -DA:248,54150 -DA:249,54150 -DA:251,54150 -DA:252,54150 -DA:253,54150 -DA:255,54150 -DA:259,54150 -DA:262,54150 -FN:265,SingleVoteGovernor.castVote -FNDA:361617,SingleVoteGovernor.castVote -DA:270,346182 -BRDA:270,11,0,256 -BRDA:270,11,1,345926 -DA:271,256 -DA:275,345926 -BRDA:275,12,0,68526 -BRDA:275,12,1,277400 -DA:276,68526 -DA:280,277400 -DA:283,277400 -BRDA:283,13,0,98304 -BRDA:283,13,1,179096 -DA:284,98304 -DA:288,179096 -BRDA:288,14,0,13836 -BRDA:288,14,1,165260 -DA:289,13836 -DA:292,165260 -BRDA:292,15,0,150553 -BRDA:292,15,1,14707 -DA:294,150553 -DA:296,14707 -BRDA:296,16,0,9801 -BRDA:296,16,1,4906 -DA:298,9801 -DA:300,4906 -BRDA:300,17,0,4906 -BRDA:300,17,1,4906 -DA:302,4906 -DA:306,165260 -FN:309,SingleVoteGovernor.executeMotion -FNDA:47077,SingleVoteGovernor.executeMotion -DA:311,47077 -DA:314,47077 -BRDA:314,18,0,256 -BRDA:314,18,1,46821 -DA:315,256 -DA:319,46821 -BRDA:319,19,0,2 -BRDA:319,19,1,46819 -DA:320,2 -DA:324,46819 -BRDA:324,20,0,1 -BRDA:324,20,1,46818 -DA:325,1 -DA:329,46818 -BRDA:329,21,0,1 -BRDA:329,21,1,46817 -DA:330,1 -DA:334,46817 -DA:337,46817 -DA:338,46817 -DA:339,46817 -DA:342,46817 -DA:343,46817 -DA:345,46817 -FNF:10 -FNH:10 -LF:94 -LH:92 -BRF:44 -BRH:42 -end_of_record -TN: SF:src/modules/authorizer/TokenGatedRoleAuthorizer.sol FN:62,TokenGatedRoleAuthorizer.isAuthorized -FNDA:29575,TokenGatedRoleAuthorizer.isAuthorized -DA:69,29575 -DA:71,29575 -BRDA:71,0,0,29565 +FNDA:28493,TokenGatedRoleAuthorizer.isAuthorized +DA:69,28493 +DA:71,28493 +BRDA:71,0,0,28483 BRDA:71,0,1,4 -DA:72,29569 -DA:74,29569 -BRDA:74,1,0,29565 +DA:72,28487 +DA:74,28487 +BRDA:74,1,0,28483 BRDA:74,1,1,4 -DA:75,29565 +DA:75,28483 DA:77,4 DA:81,6 DA:82,6 FN:90,TokenGatedRoleAuthorizer._grantRole -FNDA:8585,TokenGatedRoleAuthorizer._grantRole -DA:95,8585 +FNDA:8430,TokenGatedRoleAuthorizer._grantRole +DA:95,8430 BRDA:95,2,0,- BRDA:95,2,1,521 DA:96,521 -DA:102,8585 +DA:102,8430 FN:109,TokenGatedRoleAuthorizer.hasTokenRole -FNDA:29565,TokenGatedRoleAuthorizer.hasTokenRole -DA:114,59130 -DA:116,59130 -DA:117,59130 -DA:118,59130 -DA:119,59130 -DA:122,59130 -DA:135,32324 +FNDA:28483,TokenGatedRoleAuthorizer.hasTokenRole +DA:114,56966 +DA:116,56966 +DA:117,56966 +DA:118,56966 +DA:119,56966 +DA:122,56966 +DA:135,31320 FN:139,TokenGatedRoleAuthorizer.getThresholdValue FNDA:1,TokenGatedRoleAuthorizer.getThresholdValue DA:144,1 @@ -858,120 +654,128 @@ BRH:5 end_of_record TN: SF:src/modules/base/Module.sol -FN:119,Module.init +FN:139,Module.init FNDA:0,Module.init -DA:124,0 -FN:130,Module.__Module_init -FNDA:4650,Module.__Module_init -DA:135,4649 -BRDA:135,0,0,1 -BRDA:135,0,1,4648 -DA:136,1 -DA:138,4648 -DA:141,4648 -BRDA:141,1,0,2 -BRDA:141,1,1,4646 -DA:142,2 -DA:144,4646 -FN:147,Module.init2 +DA:144,0 +FN:150,Module.__Module_init +FNDA:4655,Module.__Module_init +DA:155,4654 +BRDA:155,0,0,1 +BRDA:155,0,1,4653 +DA:156,1 +DA:158,4653 +DA:161,4653 +BRDA:161,1,0,2 +BRDA:161,1,1,4651 +DA:162,2 +DA:164,4651 +FN:167,Module.init2 FNDA:36,Module.init2 -FN:158,Module.identifier +FN:178,Module.identifier FNDA:257,Module.identifier -DA:159,257 -FN:163,Module.version +DA:179,257 +FN:183,Module.version FNDA:1,Module.version -DA:164,1 -FN:168,Module.url +DA:184,1 +FN:188,Module.url FNDA:1,Module.url -DA:169,1 -FN:173,Module.title +DA:189,1 +FN:193,Module.title FNDA:1,Module.title -DA:174,1 -FN:178,Module.orchestrator -FNDA:74559,Module.orchestrator -DA:179,570230 -FN:189,Module._triggerOrchestratorCallback +DA:194,1 +FN:198,Module.orchestrator +FNDA:57993,Module.orchestrator +DA:199,1006921 +FN:205,Module.grantModuleRole +FNDA:516,Module.grantModuleRole +DA:209,516 +DA:210,516 +FN:213,Module.revokeModuleRole +FNDA:256,Module.revokeModuleRole +DA:217,256 +DA:218,256 +FN:228,Module._triggerOrchestratorCallback FNDA:0,Module._triggerOrchestratorCallback -DA:193,0 -DA:194,0 -DA:195,0 -DA:204,0 -FN:207,Module.decoder +DA:232,0 +DA:233,0 +DA:234,0 +DA:243,0 +FN:246,Module.decoder FNDA:45,Module.decoder -DA:212,45 -FN:215,Module._dependencyInjectionRequired +DA:251,45 +FN:254,Module._dependencyInjectionRequired FNDA:27,Module._dependencyInjectionRequired -DA:220,27 -FNF:11 -FNH:9 -LF:18 -LH:13 +DA:259,27 +FNF:13 +FNH:11 +LF:22 +LH:17 BRF:4 BRH:4 end_of_record TN: SF:src/modules/base/mixins/ERC20PaymentClient.sol FN:79,ERC20PaymentClient._addPaymentOrder -FNDA:103475,ERC20PaymentClient._addPaymentOrder -DA:85,103472 -DA:88,103472 -DA:92,103472 -DA:94,103472 +FNDA:84583,ERC20PaymentClient._addPaymentOrder +DA:85,84580 +DA:88,84580 +DA:92,84580 +DA:94,84580 FN:100,ERC20PaymentClient._addPaymentOrders -FNDA:21536,ERC20PaymentClient._addPaymentOrders -DA:101,21536 -DA:103,21536 -DA:105,21536 -DA:106,21536 -DA:107,229792 -DA:108,229792 -DA:111,229792 -DA:114,229792 -DA:116,229792 -DA:120,21536 -DA:124,21536 +FNDA:21707,ERC20PaymentClient._addPaymentOrders +DA:101,21707 +DA:103,21707 +DA:105,21707 +DA:106,21707 +DA:107,228161 +DA:108,228161 +DA:111,228161 +DA:114,228161 +DA:116,228161 +DA:120,21707 +DA:124,21707 FN:131,ERC20PaymentClient.collectPaymentOrders -FNDA:7109,ERC20PaymentClient.collectPaymentOrders -DA:138,7109 +FNDA:7127,ERC20PaymentClient.collectPaymentOrders +DA:138,7127 BRDA:138,0,0,1 -BRDA:138,0,1,7108 +BRDA:138,0,1,7126 DA:139,1 -DA:145,7108 -DA:150,7108 -DA:151,7108 -DA:152,7108 -DA:153,129020 -DA:157,7108 -DA:160,7108 -DA:163,7108 -DA:168,7108 -DA:172,7108 +DA:145,7126 +DA:150,7126 +DA:151,7126 +DA:152,7126 +DA:153,110104 +DA:157,7126 +DA:160,7126 +DA:163,7126 +DA:168,7126 +DA:172,7126 FN:176,ERC20PaymentClient.paymentOrders -FNDA:9410,ERC20PaymentClient.paymentOrders -DA:182,9410 +FNDA:9428,ERC20PaymentClient.paymentOrders +DA:182,9428 FN:186,ERC20PaymentClient.outstandingTokenAmount FNDA:513,ERC20PaymentClient.outstandingTokenAmount DA:187,513 FN:193,ERC20PaymentClient._ensureValidRecipient -FNDA:177582,ERC20PaymentClient._ensureValidRecipient -DA:194,177582 +FNDA:170314,ERC20PaymentClient._ensureValidRecipient +DA:194,170314 BRDA:194,1,0,1 -BRDA:194,1,1,177581 +BRDA:194,1,1,170313 DA:195,1 FN:199,ERC20PaymentClient._ensureValidAmount -FNDA:177615,ERC20PaymentClient._ensureValidAmount -DA:200,177615 +FNDA:170362,ERC20PaymentClient._ensureValidAmount +DA:200,170362 BRDA:200,2,0,1 -BRDA:200,2,1,177614 +BRDA:200,2,1,170361 FN:203,ERC20PaymentClient._ensureValidPaymentOrder -FNDA:333267,ERC20PaymentClient._ensureValidPaymentOrder -DA:204,333267 +FNDA:312744,ERC20PaymentClient._ensureValidPaymentOrder +DA:204,312744 BRDA:204,3,0,1 -BRDA:204,3,1,333266 +BRDA:204,3,1,312743 DA:205,1 -DA:207,333266 +DA:207,312743 BRDA:207,4,0,2 -BRDA:207,4,1,333264 +BRDA:207,4,1,312741 DA:208,2 FNF:8 FNH:8 @@ -983,56 +787,56 @@ end_of_record TN: SF:src/modules/fundingManager/RebasingFundingManager.sol FN:59,RebasingFundingManager.init -FNDA:263,RebasingFundingManager.init -DA:64,262 -DA:66,262 -DA:68,262 -DA:69,262 -DA:72,262 -DA:74,262 +FNDA:264,RebasingFundingManager.init +DA:64,263 +DA:66,263 +DA:68,263 +DA:69,263 +DA:72,263 +DA:74,263 FN:81,RebasingFundingManager.token FNDA:0,RebasingFundingManager.token -DA:82,75372 +DA:82,86750 FN:86,RebasingFundingManager._supplyTarget -FNDA:28169,RebasingFundingManager._supplyTarget -DA:92,28169 +FNDA:32283,RebasingFundingManager._supplyTarget +DA:92,32283 FN:98,RebasingFundingManager.deposit -FNDA:12460,RebasingFundingManager.deposit -DA:99,12460 +FNDA:14280,RebasingFundingManager.deposit +DA:99,14280 FN:102,RebasingFundingManager.depositFor -FNDA:7854,RebasingFundingManager.depositFor -DA:103,7854 +FNDA:9184,RebasingFundingManager.depositFor +DA:103,9184 FN:106,RebasingFundingManager.withdraw -FNDA:3610,RebasingFundingManager.withdraw -DA:107,3610 +FNDA:4089,RebasingFundingManager.withdraw +DA:107,4089 FN:110,RebasingFundingManager.withdrawTo -FNDA:3477,RebasingFundingManager.withdrawTo -DA:111,3477 +FNDA:3962,RebasingFundingManager.withdrawTo +DA:111,3962 FN:117,RebasingFundingManager.transferOrchestratorToken FNDA:774,RebasingFundingManager.transferOrchestratorToken -DA:122,517 +DA:122,518 FN:128,RebasingFundingManager._deposit -FNDA:20314,RebasingFundingManager._deposit -DA:130,20314 +FNDA:23464,RebasingFundingManager._deposit +DA:130,23464 BRDA:130,0,0,256 -BRDA:130,0,1,20058 +BRDA:130,0,1,23208 DA:131,256 -DA:134,20058 +DA:134,23208 BRDA:134,1,0,- -BRDA:134,1,1,20058 +BRDA:134,1,1,23208 DA:135,0 -DA:138,20058 -DA:140,20058 -DA:142,20058 +DA:138,23208 +DA:140,23208 +DA:142,23208 FN:145,RebasingFundingManager._withdraw -FNDA:7087,RebasingFundingManager._withdraw -DA:146,7087 -DA:148,7087 -DA:150,7087 +FNDA:8051,RebasingFundingManager._withdraw +DA:146,8051 +DA:148,8051 +DA:150,8051 FN:153,RebasingFundingManager._transferOrchestratorToken -FNDA:517,RebasingFundingManager._transferOrchestratorToken -DA:154,517 -DA:156,517 +FNDA:518,RebasingFundingManager._transferOrchestratorToken +DA:154,518 +DA:156,518 FNF:11 FNH:10 LF:25 @@ -1043,15 +847,15 @@ end_of_record TN: SF:src/modules/fundingManager/token/ElasticReceiptTokenBase.sol FN:201,ElasticReceiptTokenBase.transfer -FNDA:488,ElasticReceiptTokenBase.transfer -DA:209,488 -DA:211,488 +FNDA:500,ElasticReceiptTokenBase.transfer +DA:209,500 +DA:211,500 DA:213,256 FN:217,ElasticReceiptTokenBase.transferFrom -FNDA:1261,ElasticReceiptTokenBase.transferFrom -DA:226,1261 -DA:228,1261 -DA:229,749 +FNDA:1266,ElasticReceiptTokenBase.transferFrom +DA:226,1266 +DA:228,1266 +DA:229,754 DA:231,512 FN:235,ElasticReceiptTokenBase.transferAll FNDA:256,ElasticReceiptTokenBase.transferAll @@ -1071,10 +875,10 @@ DA:269,256 DA:272,512 DA:274,512 FN:278,ElasticReceiptTokenBase.approve -FNDA:2029,ElasticReceiptTokenBase.approve -DA:284,2029 -DA:286,2029 -DA:287,2029 +FNDA:2034,ElasticReceiptTokenBase.approve +DA:284,2034 +DA:286,2034 +DA:287,2034 FN:295,ElasticReceiptTokenBase.increaseAllowance FNDA:512,ElasticReceiptTokenBase.increaseAllowance DA:299,512 @@ -1110,8 +914,8 @@ FN:398,ElasticReceiptTokenBase.totalSupply FNDA:780,ElasticReceiptTokenBase.totalSupply DA:399,780 FN:403,ElasticReceiptTokenBase.balanceOf -FNDA:56451,ElasticReceiptTokenBase.balanceOf -DA:404,56451 +FNDA:64857,ElasticReceiptTokenBase.balanceOf +DA:404,64857 FN:408,ElasticReceiptTokenBase.scaledTotalSupply FNDA:2,ElasticReceiptTokenBase.scaledTotalSupply DA:409,2 @@ -1125,67 +929,67 @@ FN:426,ElasticReceiptTokenBase.DOMAIN_SEPARATOR FNDA:1,ElasticReceiptTokenBase.DOMAIN_SEPARATOR DA:427,2 FN:442,ElasticReceiptTokenBase._tokensToBits -FNDA:32081,ElasticReceiptTokenBase._tokensToBits -DA:443,32081 +FNDA:36389,ElasticReceiptTokenBase._tokensToBits +DA:443,36389 FN:449,ElasticReceiptTokenBase._bitsToTokens -FNDA:8274,ElasticReceiptTokenBase._bitsToTokens -DA:450,8274 +FNDA:9229,ElasticReceiptTokenBase._bitsToTokens +DA:450,9229 FN:459,ElasticReceiptTokenBase._mint -FNDA:23474,ElasticReceiptTokenBase._mint -DA:466,23431 -BRDA:466,4,0,349 -BRDA:466,4,1,23082 -DA:467,349 -DA:471,23082 -DA:472,23082 -DA:478,23082 -DA:479,23082 -BRDA:479,5,0,4046 -BRDA:479,5,1,23082 -DA:480,4046 -DA:484,23082 -DA:485,23082 -DA:488,23082 +FNDA:26802,ElasticReceiptTokenBase._mint +DA:466,26776 +BRDA:466,4,0,358 +BRDA:466,4,1,26418 +DA:467,358 +DA:471,26418 +DA:472,26418 +DA:478,26418 +DA:479,26418 +BRDA:479,5,0,4233 +BRDA:479,5,1,26418 +DA:480,4233 +DA:484,26418 +DA:485,26418 +DA:488,26418 FN:498,ElasticReceiptTokenBase._burn -FNDA:7250,ElasticReceiptTokenBase._burn -DA:506,7250 -DA:507,7250 -DA:510,7250 -DA:511,7250 -DA:516,7250 -DA:517,7250 -DA:520,7087 -DA:521,7087 -DA:524,7087 +FNDA:8205,ElasticReceiptTokenBase._burn +DA:506,8205 +DA:507,8205 +DA:510,8205 +DA:511,8205 +DA:516,8205 +DA:517,8205 +DA:520,8051 +DA:521,8051 +DA:524,8051 FN:533,ElasticReceiptTokenBase._rebase -FNDA:34758,ElasticReceiptTokenBase._rebase -DA:534,34758 -DA:538,34758 -BRDA:538,6,0,4397 -BRDA:538,6,1,30361 -DA:539,4397 -DA:543,30361 -DA:544,30361 -DA:547,30361 -DA:548,30361 +FNDA:39075,ElasticReceiptTokenBase._rebase +DA:534,39075 +DA:538,39075 +BRDA:538,6,0,4593 +BRDA:538,6,1,34482 +DA:539,4593 +DA:543,34482 +DA:544,34482 +DA:547,34482 +DA:548,34482 FN:553,ElasticReceiptTokenBase._activeBits -FNDA:60695,ElasticReceiptTokenBase._activeBits -DA:554,60695 +FNDA:69107,ElasticReceiptTokenBase._activeBits +DA:554,69107 FN:559,ElasticReceiptTokenBase._transfer -FNDA:32337,ElasticReceiptTokenBase._transfer -DA:562,32337 -DA:563,31868 -DA:565,31868 -BRDA:565,7,0,2561 -BRDA:565,7,1,31868 -DA:566,2561 -DA:569,31868 +FNDA:36645,ElasticReceiptTokenBase._transfer +DA:562,36645 +DA:563,36159 +DA:565,36159 +BRDA:565,7,0,2864 +BRDA:565,7,1,36159 +DA:566,2864 +DA:569,36159 FN:574,ElasticReceiptTokenBase._useAllowance -FNDA:2029,ElasticReceiptTokenBase._useAllowance -DA:578,2029 -BRDA:578,8,0,1773 -BRDA:578,8,1,1261 -DA:579,1773 +FNDA:2034,ElasticReceiptTokenBase._useAllowance +DA:578,2034 +BRDA:578,8,0,1778 +BRDA:578,8,1,1266 +DA:579,1778 FNF:24 FNH:24 LF:78 @@ -1196,14 +1000,14 @@ end_of_record TN: SF:src/modules/fundingManager/token/ElasticReceiptTokenUpgradeable.sol FN:13,ElasticReceiptTokenUpgradeable.__ElasticReceiptToken_init -FNDA:345,ElasticReceiptTokenUpgradeable.__ElasticReceiptToken_init -DA:18,345 -BRDA:18,0,0,78 -BRDA:18,0,1,267 -DA:21,267 -DA:22,267 -DA:23,267 -DA:29,267 +FNDA:524,ElasticReceiptTokenUpgradeable.__ElasticReceiptToken_init +DA:18,524 +BRDA:18,0,0,256 +BRDA:18,0,1,268 +DA:21,268 +DA:22,268 +DA:23,268 +DA:29,268 FNF:1 FNH:1 LF:5 @@ -1214,23 +1018,23 @@ end_of_record TN: SF:src/modules/lib/LibMetadata.sol FN:17,LibMetadata.identifier -FNDA:3614,LibMetadata.identifier -DA:22,3614 +FNDA:3362,LibMetadata.identifier +DA:22,3362 FN:32,LibMetadata.isValid -FNDA:5678,LibMetadata.isValid -DA:38,5678 -BRDA:38,0,0,2 -BRDA:38,0,1,5676 -DA:39,2 -DA:43,5676 -BRDA:43,1,0,2 -BRDA:43,1,1,5674 -DA:44,2 -DA:48,5674 +FNDA:1030,LibMetadata.isValid +DA:38,1030 +BRDA:38,0,0,1 +BRDA:38,0,1,1029 +DA:39,1 +DA:43,1029 +BRDA:43,1,0,1 +BRDA:43,1,1,1028 +DA:44,1 +DA:48,1028 BRDA:48,2,0,- -BRDA:48,2,1,5674 +BRDA:48,2,1,1028 DA:49,0 -DA:52,5674 +DA:52,1028 FNF:2 FNH:2 LF:8 @@ -1240,189 +1044,157 @@ BRH:5 end_of_record TN: SF:src/modules/logicModule/BountyManager.sol -FN:105,BountyManager.validContributorsForBounty -FNDA:157107,BountyManager.validContributorsForBounty -DA:110,157107 -DA:112,157107 -BRDA:112,0,0,2 -BRDA:112,0,1,157105 -DA:113,2 -DA:115,157105 -DA:116,157105 -DA:117,157105 -DA:118,157105 -DA:119,157105 -DA:120,623464 -DA:123,623464 -BRDA:123,1,0,111 -BRDA:123,1,1,623353 -DA:124,111 -DA:127,623353 -DA:129,623353 -DA:130,623333 -BRDA:128,2,0,20 -BRDA:128,2,1,623333 -DA:132,20 -DA:135,623333 -DA:137,623333 -DA:142,156974 -DA:143,156912 -BRDA:141,3,0,83 -BRDA:141,3,1,156891 -DA:145,83 -FN:194,BountyManager.init -FNDA:4,BountyManager.init -DA:199,3 -DA:201,3 -DA:202,3 -FN:205,BountyManager.init2 -FNDA:3,BountyManager.init2 -DA:212,3 -FN:220,BountyManager.getBountyInformation -FNDA:4861,BountyManager.getBountyInformation -DA:226,4632 -FN:230,BountyManager.listBountyIds +FN:88,BountyManager.validContributorsForBounty +FNDA:156586,BountyManager.validContributorsForBounty +DA:93,156586 +DA:95,156586 +BRDA:95,0,0,4 +BRDA:95,0,1,156582 +DA:96,4 +DA:98,156582 +DA:99,156582 +DA:100,156582 +DA:101,156582 +DA:102,156582 +DA:103,619891 +DA:106,619891 +BRDA:106,1,0,115 +BRDA:106,1,1,619776 +DA:107,115 +DA:110,619776 +DA:112,619776 +BRDA:111,2,0,34 +BRDA:111,2,1,619742 +DA:115,34 +DA:118,619742 +DA:120,619742 +DA:125,156433 +BRDA:124,3,0,73 +BRDA:124,3,1,156360 +DA:128,73 +FN:177,BountyManager.init +FNDA:5,BountyManager.init +DA:182,4 +DA:184,4 +DA:185,4 +FN:188,BountyManager.init2 +FNDA:4,BountyManager.init2 +DA:195,4 +FN:202,BountyManager.getBountyInformation +FNDA:4529,BountyManager.getBountyInformation +DA:208,4302 +FN:212,BountyManager.listBountyIds FNDA:0,BountyManager.listBountyIds -DA:231,0 -FN:235,BountyManager.isExistingBountyId -FNDA:1,BountyManager.isExistingBountyId -DA:236,163081 -FN:240,BountyManager.getClaimInformation -FNDA:7203,BountyManager.getClaimInformation -DA:246,6977 -FN:250,BountyManager.listClaimIds +DA:213,0 +FN:217,BountyManager.isExistingBountyId +FNDA:2,BountyManager.isExistingBountyId +DA:218,162228 +FN:222,BountyManager.getClaimInformation +FNDA:7304,BountyManager.getClaimInformation +DA:228,7064 +FN:232,BountyManager.listClaimIds FNDA:0,BountyManager.listClaimIds -DA:251,0 -FN:255,BountyManager.isExistingClaimId +DA:233,0 +FN:237,BountyManager.isExistingClaimId FNDA:0,BountyManager.isExistingClaimId -DA:256,8825 -FN:260,BountyManager.listClaimIdsForContributorAddress -FNDA:297804,BountyManager.listClaimIdsForContributorAddress -DA:265,297804 -FN:272,BountyManager.addBounty -FNDA:135969,BountyManager.addBounty -DA:283,135631 -DA:286,135631 -DA:288,135631 -DA:290,135631 -DA:291,135631 -DA:292,135631 -DA:294,135631 -DA:298,135631 -FN:302,BountyManager.updateBounty +DA:238,8925 +FN:242,BountyManager.listClaimIdsForContributorAddress +FNDA:296509,BountyManager.listClaimIdsForContributorAddress +DA:247,296509 +FN:254,BountyManager.addBounty +FNDA:141418,BountyManager.addBounty +DA:265,141289 +DA:268,141289 +DA:270,141289 +DA:272,141289 +DA:273,141289 +DA:274,141289 +DA:276,141289 +DA:280,141289 +FN:284,BountyManager.updateBounty FNDA:258,BountyManager.updateBounty -DA:307,256 -DA:309,256 -FN:313,BountyManager.lockBounty +DA:289,256 +DA:291,256 +FN:295,BountyManager.lockBounty FNDA:6,BountyManager.lockBounty -DA:319,3 -DA:321,3 -FN:325,BountyManager.addClaim -FNDA:156853,BountyManager.addClaim -DA:336,156850 -DA:338,156635 -DA:341,156635 -DA:343,156635 -DA:346,156635 -DA:348,156635 -DA:349,156635 -DA:350,608618 -DA:352,608618 -DA:354,608618 -DA:358,156635 -DA:360,156635 -DA:362,156635 -FN:366,BountyManager.updateClaimContributors +DA:301,3 +DA:303,3 +FN:307,BountyManager.addClaim +FNDA:156332,BountyManager.addClaim +DA:318,156329 +DA:320,156104 +DA:323,156104 +DA:325,156104 +DA:328,156104 +DA:330,156104 +DA:331,156104 +DA:332,605740 +DA:334,605740 +DA:336,605740 +DA:340,156104 +DA:342,156104 +DA:344,156104 +FN:348,BountyManager.updateClaimContributors FNDA:260,BountyManager.updateClaimContributors -DA:376,257 -DA:377,256 -DA:379,256 -DA:380,256 -DA:382,512 -DA:384,512 -DA:388,256 -DA:390,256 -DA:392,256 -DA:393,11594 -DA:395,11594 -DA:397,11594 -DA:401,256 -FN:405,BountyManager.updateClaimDetails +DA:358,257 +DA:359,256 +DA:361,256 +DA:362,256 +DA:364,512 +DA:366,512 +DA:370,256 +DA:372,256 +DA:374,256 +DA:375,11191 +DA:377,11191 +DA:379,11191 +DA:383,256 +FN:387,BountyManager.updateClaimDetails FNDA:514,BountyManager.updateClaimDetails -DA:410,256 -DA:412,256 -FN:416,BountyManager.verifyClaim -FNDA:849,BountyManager.verifyClaim -DA:424,661 -DA:426,661 -DA:429,661 -DA:432,661 -DA:435,661 -DA:436,12208 -DA:437,12208 -DA:439,12208 -DA:448,12208 -DA:453,661 -DA:456,661 -DA:461,661 -DA:463,661 -FN:470,BountyManager.grantBountyAdminRole -FNDA:513,BountyManager.grantBountyAdminRole -DA:472,513 -DA:473,513 -DA:474,513 -FN:478,BountyManager.grantClaimAdminRole -FNDA:1,BountyManager.grantClaimAdminRole -DA:479,1 +DA:392,260 +DA:394,260 +FN:398,BountyManager.verifyClaim +FNDA:848,BountyManager.verifyClaim +DA:406,666 +DA:408,666 +DA:411,666 +DA:414,666 +DA:417,666 +DA:418,11952 +DA:419,11952 +DA:421,11952 +DA:430,11952 +DA:435,666 +DA:438,666 +DA:443,666 +DA:445,666 +FN:451,BountyManager._ensureTokenBalance +FNDA:12619,BountyManager._ensureTokenBalance +DA:455,12619 +DA:457,12619 +BRDA:457,4,0,- +BRDA:457,4,1,11952 +DA:460,11952 +DA:461,11952 +DA:470,11952 +BRDA:470,5,0,- +BRDA:470,5,1,11952 +DA:471,0 +FN:476,BountyManager._ensureTokenAllowance +FNDA:1,BountyManager._ensureTokenAllowance DA:480,1 DA:481,1 -FN:485,BountyManager.grantVerifyAdminRole -FNDA:1,BountyManager.grantVerifyAdminRole -DA:486,1 -DA:487,1 -DA:488,1 -FN:492,BountyManager.revokeBountyAdminRole -FNDA:256,BountyManager.revokeBountyAdminRole -DA:493,256 -DA:494,256 -DA:495,256 -FN:499,BountyManager.revokeClaimAdminRole -FNDA:0,BountyManager.revokeClaimAdminRole -DA:500,0 -DA:501,0 -DA:502,0 -FN:506,BountyManager.revokeVerifyAdminRole -FNDA:0,BountyManager.revokeVerifyAdminRole -DA:507,0 -DA:508,0 -DA:509,0 -FN:515,BountyManager._ensureTokenBalance -FNDA:12870,BountyManager._ensureTokenBalance -DA:519,12870 -DA:521,12870 -BRDA:521,4,0,- -BRDA:521,4,1,12208 -DA:524,12208 -DA:525,12208 -DA:534,12208 -BRDA:534,5,0,- -BRDA:534,5,1,12208 -DA:535,0 -FN:540,BountyManager._ensureTokenAllowance -FNDA:1,BountyManager._ensureTokenAllowance -DA:544,1 -DA:545,1 -DA:547,1 -BRDA:547,6,0,1 -BRDA:547,6,1,1 -DA:548,1 -FN:552,BountyManager._isAuthorizedPaymentProcessor +DA:483,1 +BRDA:483,6,0,1 +BRDA:483,6,1,1 +DA:484,1 +FN:488,BountyManager._isAuthorizedPaymentProcessor FNDA:1,BountyManager._isAuthorizedPaymentProcessor -DA:558,1 -FNF:26 -FNH:21 -LF:113 -LH:104 +DA:494,1 +FNF:20 +FNH:17 +LF:93 +LH:90 BRF:14 BRH:12 end_of_record @@ -1440,11 +1212,11 @@ BRDA:210,0,0,- BRDA:210,0,1,3 DA:211,0 FN:219,MilestoneManager.getMilestoneInformation -FNDA:5194,MilestoneManager.getMilestoneInformation -DA:225,9292 +FNDA:5168,MilestoneManager.getMilestoneInformation +DA:225,9266 FN:229,MilestoneManager.listMilestoneIds -FNDA:6855,MilestoneManager.listMilestoneIds -DA:230,6855 +FNDA:7147,MilestoneManager.listMilestoneIds +DA:230,7147 FN:234,MilestoneManager.getActiveMilestoneId FNDA:514,MilestoneManager.getActiveMilestoneId DA:235,514 @@ -1461,31 +1233,30 @@ DA:245,5 DA:248,1026 DA:252,1026 DA:253,1026 -DA:254,770 FN:258,MilestoneManager.isNextMilestoneActivatable FNDA:771,MilestoneManager.isNextMilestoneActivatable -DA:260,11806 -DA:261,11806 +DA:260,11860 +DA:261,11860 BRDA:261,3,0,259 -BRDA:261,3,1,11547 +BRDA:261,3,1,11601 DA:262,259 -DA:266,11547 +DA:266,11601 BRDA:265,4,0,512 -BRDA:265,4,1,11035 +BRDA:265,4,1,11089 DA:269,512 -DA:273,11035 +DA:273,11089 BRDA:273,5,0,- -BRDA:273,5,1,11035 +BRDA:273,5,1,11089 DA:274,0 -DA:278,11035 +DA:278,11089 BRDA:278,6,0,8196 -BRDA:278,6,1,2839 +BRDA:278,6,1,2893 DA:279,8196 -DA:282,2839 -DA:286,2839 +DA:282,2893 +DA:286,2893 FN:290,MilestoneManager.isExistingMilestoneId FNDA:1,MilestoneManager.isExistingMilestoneId -DA:291,47706 +DA:291,48080 FN:295,MilestoneManager.getPreviousMilestoneId FNDA:768,MilestoneManager.getPreviousMilestoneId DA:300,768 @@ -1494,9 +1265,9 @@ FNDA:2,MilestoneManager.isContributor DA:309,4355 DA:312,4099 DA:313,4099 -DA:314,10114 +DA:314,10087 BRDA:314,7,0,3843 -BRDA:314,7,1,6271 +BRDA:314,7,1,6244 DA:315,3843 DA:318,256 FN:322,MilestoneManager.getSalaryPrecision @@ -1512,14 +1283,13 @@ FN:335,MilestoneManager.getMilestoneUpdateTimelock FNDA:1,MilestoneManager.getMilestoneUpdateTimelock DA:336,1 FN:343,MilestoneManager.addMilestone -FNDA:31931,MilestoneManager.addMilestone -DA:349,31675 -DA:351,31667 +FNDA:31807,MilestoneManager.addMilestone +DA:349,31551 +DA:351,31543 FN:355,MilestoneManager.stopMilestone FNDA:1025,MilestoneManager.stopMilestone DA:360,769 DA:365,769 -DA:366,768 BRDA:364,8,0,1 BRDA:364,8,1,768 DA:368,1 @@ -1528,49 +1298,49 @@ DA:375,768 DA:378,768 DA:382,768 FN:386,MilestoneManager.removeMilestone -FNDA:5575,MilestoneManager.removeMilestone -DA:391,5318 -DA:395,5318 +FNDA:5867,MilestoneManager.removeMilestone +DA:391,5610 +DA:395,5610 BRDA:395,9,0,256 -BRDA:395,9,1,5062 +BRDA:395,9,1,5354 DA:396,256 -DA:400,5062 -DA:403,5062 -DA:405,5062 +DA:400,5354 +DA:403,5354 +DA:405,5354 FN:409,MilestoneManager.startNextMilestone -FNDA:11291,MilestoneManager.startNextMilestone -DA:410,11035 +FNDA:11345,MilestoneManager.startNextMilestone +DA:410,11089 BRDA:410,10,0,257 -BRDA:410,10,1,10778 +BRDA:410,10,1,10832 DA:411,257 -DA:415,10778 -DA:416,10778 -DA:419,10778 -DA:422,10778 -DA:424,10778 -DA:426,10778 +DA:415,10832 +DA:416,10832 +DA:419,10832 +DA:422,10832 +DA:424,10832 +DA:426,10832 BRDA:426,11,0,- -BRDA:426,11,1,191620 -DA:428,10778 -DA:430,10778 -DA:432,10778 -DA:433,10522 -DA:436,10522 -DA:437,10522 +BRDA:426,11,1,190215 +DA:428,10832 +DA:430,10832 +DA:432,10832 +DA:433,10576 +DA:436,10576 +DA:437,10576 BRDA:437,12,0,- -BRDA:437,12,1,170 -DA:439,170 -DA:440,170 -DA:443,170 -DA:452,10522 +BRDA:437,12,1,185 +DA:439,185 +DA:440,185 +DA:443,185 +DA:452,10576 BRDA:452,13,0,- -BRDA:452,13,1,191620 -DA:454,10352 -DA:455,10352 -DA:456,191620 -DA:466,10352 -DA:470,10522 -DA:474,10522 +BRDA:452,13,1,190215 +DA:454,10391 +DA:455,10391 +DA:456,190215 +DA:466,10391 +DA:470,10576 +DA:474,10576 FN:478,MilestoneManager.updateMilestone FNDA:2050,MilestoneManager.updateMilestone DA:485,1793 @@ -1591,18 +1361,17 @@ BRDA:501,16,1,1536 DA:502,512 DA:503,512 DA:507,1536 -DA:508,1536 BRDA:506,17,0,256 BRDA:506,17,1,1536 DA:510,256 DA:511,256 DA:514,1536 BRDA:514,18,0,- -BRDA:514,18,1,12399 +BRDA:514,18,1,12513 DA:516,512 DA:517,512 DA:518,512 -DA:519,12399 +DA:519,12513 DA:521,512 DA:524,1536 BRDA:524,19,0,1536 @@ -1653,20 +1422,20 @@ BRDA:597,25,1,- DA:598,0 DA:600,0 FN:613,MilestoneManager._addMilestone -FNDA:31667,MilestoneManager._addMilestone -DA:620,31667 -DA:623,31667 -DA:626,31667 -DA:627,31667 -DA:629,31667 -DA:630,31667 -DA:631,286912 -DA:634,31667 -DA:635,31667 -DA:637,31667 -DA:641,31667 +FNDA:31543,MilestoneManager._addMilestone +DA:620,31543 +DA:623,31543 +DA:626,31543 +DA:627,31543 +DA:629,31543 +DA:630,31543 +DA:631,284313 +DA:634,31543 +DA:635,31543 +DA:637,31543 +DA:641,31543 FN:654,MilestoneManager._validateMilestoneDetails -FNDA:33468,MilestoneManager._validateMilestoneDetails +FNDA:33344,MilestoneManager._validateMilestoneDetails FN:664,MilestoneManager.hashContributors FNDA:3072,MilestoneManager.hashContributors DA:669,3072 @@ -1674,25 +1443,25 @@ DA:671,3072 DA:672,3072 DA:673,3072 DA:675,3072 -DA:676,40545 -DA:677,40545 -DA:678,40545 +DA:676,40665 +DA:677,40665 +DA:678,40665 DA:681,3072 FN:684,MilestoneManager.updateMilestoneUpdateTimelock FNDA:0,MilestoneManager.updateMilestoneUpdateTimelock DA:688,0 DA:689,0 FN:695,MilestoneManager._ensureTokenBalance -FNDA:21302,MilestoneManager._ensureTokenBalance -DA:699,21302 -DA:701,21302 +FNDA:21410,MilestoneManager._ensureTokenBalance +DA:699,21410 +DA:701,21410 BRDA:701,26,0,256 -BRDA:701,26,1,18206 -DA:704,18462 -DA:705,18462 -DA:714,18462 +BRDA:701,26,1,18260 +DA:704,18516 +DA:705,18516 +DA:714,18516 BRDA:714,27,0,256 -BRDA:714,27,1,18206 +BRDA:714,27,1,18260 DA:715,256 FN:720,MilestoneManager._ensureTokenAllowance FNDA:2,MilestoneManager._ensureTokenAllowance @@ -1707,8 +1476,8 @@ FNDA:2,MilestoneManager._isAuthorizedPaymentProcessor DA:738,2 FNF:30 FNH:27 -LF:159 -LH:151 +LF:156 +LH:148 BRF:58 BRH:50 end_of_record @@ -1724,135 +1493,135 @@ BRDA:98,0,0,2 BRDA:98,0,1,2308 DA:99,2 FN:107,RecurringPaymentManager.getEpochLength -FNDA:42644,RecurringPaymentManager.getEpochLength -DA:108,42644 +FNDA:42454,RecurringPaymentManager.getEpochLength +DA:108,42454 FN:112,RecurringPaymentManager.getRecurringPaymentInformation -FNDA:341893,RecurringPaymentManager.getRecurringPaymentInformation -DA:118,341659 +FNDA:332839,RecurringPaymentManager.getRecurringPaymentInformation +DA:118,332604 FN:122,RecurringPaymentManager.listRecurringPaymentIds -FNDA:14188,RecurringPaymentManager.listRecurringPaymentIds -DA:123,14188 +FNDA:14338,RecurringPaymentManager.listRecurringPaymentIds +DA:123,14338 FN:127,RecurringPaymentManager.getPreviousPaymentId FNDA:0,RecurringPaymentManager.getPreviousPaymentId DA:128,0 FN:132,RecurringPaymentManager.isExistingRecurringPaymentId FNDA:0,RecurringPaymentManager.isExistingRecurringPaymentId -DA:133,343685 +DA:133,334631 FN:140,RecurringPaymentManager.getEpochFromTimestamp FNDA:0,RecurringPaymentManager.getEpochFromTimestamp DA:145,0 FN:149,RecurringPaymentManager.getCurrentEpoch -FNDA:144634,RecurringPaymentManager.getCurrentEpoch -DA:150,334199 +FNDA:136683,RecurringPaymentManager.getCurrentEpoch +DA:150,319127 FN:154,RecurringPaymentManager.getFutureEpoch FNDA:768,RecurringPaymentManager.getFutureEpoch DA:159,768 FN:166,RecurringPaymentManager.addRecurringPayment -FNDA:177616,RecurringPaymentManager.addRecurringPayment -DA:179,177581 -DA:182,177581 -DA:185,177581 -DA:186,177581 -DA:188,177581 -DA:190,177581 -DA:192,177581 -DA:200,177581 +FNDA:170363,RecurringPaymentManager.addRecurringPayment +DA:179,170313 +DA:182,170313 +DA:185,170313 +DA:186,170313 +DA:188,170313 +DA:190,170313 +DA:192,170313 +DA:200,170313 FN:204,RecurringPaymentManager.removeRecurringPayment -FNDA:7667,RecurringPaymentManager.removeRecurringPayment -DA:209,7666 -DA:212,7666 -DA:215,7666 -DA:217,7666 +FNDA:7781,RecurringPaymentManager.removeRecurringPayment +DA:209,7780 +DA:212,7780 +DA:215,7780 +DA:217,7780 FN:224,RecurringPaymentManager.trigger -FNDA:3261,RecurringPaymentManager.trigger -DA:225,3261 +FNDA:3279,RecurringPaymentManager.trigger +DA:225,3279 FN:229,RecurringPaymentManager.triggerFor FNDA:1024,RecurringPaymentManager.triggerFor DA:236,256 FN:239,RecurringPaymentManager._triggerFor -FNDA:11183,RecurringPaymentManager._triggerFor -DA:241,11183 -DA:243,11183 -DA:246,11183 -DA:249,171457 -DA:250,160274 -DA:251,160274 -DA:259,11183 -DA:260,11183 -DA:263,11183 -DA:266,11183 -DA:269,11183 -DA:272,11183 -DA:275,171457 -DA:276,160274 -DA:279,160274 +FNDA:11315,RecurringPaymentManager._triggerFor +DA:241,11315 +DA:243,11315 +DA:246,11315 +DA:249,167022 +DA:250,155707 +DA:251,155707 +DA:259,11315 +DA:260,11315 +DA:263,11315 +DA:266,11315 +DA:269,11315 +DA:272,11315 +DA:275,167022 +DA:276,155707 +DA:279,155707 BRDA:279,1,0,- -BRDA:279,1,1,17959 -DA:280,20210 -DA:283,20210 +BRDA:279,1,1,17901 +DA:280,20042 +DA:283,20042 BRDA:283,2,0,- -BRDA:283,2,1,17959 -DA:284,20210 -DA:285,20210 +BRDA:283,2,1,17901 +DA:284,20042 +DA:285,20042 BRDA:285,3,0,- -BRDA:285,3,1,17959 -DA:286,17959 -DA:291,160274 -DA:293,160274 -DA:296,11183 -DA:299,11183 -DA:300,160274 -BRDA:300,4,0,20210 -BRDA:300,4,1,160274 -DA:301,160274 -BRDA:301,5,0,17959 -BRDA:301,5,1,160274 -DA:303,11183 -DA:305,11183 -DA:307,11183 -DA:310,11183 -DA:313,171457 -DA:315,160274 +BRDA:285,3,1,17901 +DA:286,17901 +DA:291,155707 +DA:293,155707 +DA:296,11315 +DA:299,11315 +DA:300,155707 +BRDA:300,4,0,20042 +BRDA:300,4,1,155707 +DA:301,155707 +BRDA:301,5,0,17901 +BRDA:301,5,1,155707 +DA:303,11315 +DA:305,11315 +DA:307,11315 +DA:310,11315 +DA:313,167022 +DA:315,155707 BRDA:315,6,0,- -BRDA:315,6,1,17959 -DA:317,20210 -DA:320,20210 -DA:327,20210 -DA:330,20210 +BRDA:315,6,1,17901 +DA:317,20042 +DA:320,20042 +DA:327,20042 +DA:330,20042 BRDA:330,7,0,- -BRDA:330,7,1,17959 -DA:332,17959 -DA:335,17959 -DA:344,17959 -DA:347,20210 -DA:351,160274 -DA:352,160274 -DA:355,11183 -DA:358,11183 -DA:362,11183 +BRDA:330,7,1,17901 +DA:332,17901 +DA:335,17901 +DA:344,17901 +DA:347,20042 +DA:351,155707 +DA:352,155707 +DA:355,11315 +DA:358,11315 +DA:362,11315 FN:367,RecurringPaymentManager._ensureTokenBalance -FNDA:14444,RecurringPaymentManager._ensureTokenBalance -DA:371,14444 -DA:373,14444 +FNDA:14594,RecurringPaymentManager._ensureTokenBalance +DA:371,14594 +DA:373,14594 BRDA:373,8,0,- -BRDA:373,8,1,3356 -DA:376,3356 -DA:377,3356 -DA:386,3356 +BRDA:373,8,1,3381 +DA:376,3381 +DA:377,3381 +DA:386,3381 BRDA:386,9,0,- -BRDA:386,9,1,3356 +BRDA:386,9,1,3381 DA:387,0 FN:392,RecurringPaymentManager._ensureTokenAllowance -FNDA:3261,RecurringPaymentManager._ensureTokenAllowance -DA:396,3261 -DA:397,3261 -DA:399,3261 -BRDA:399,10,0,2244 -BRDA:399,10,1,3261 -DA:400,2244 +FNDA:3279,RecurringPaymentManager._ensureTokenAllowance +DA:396,3279 +DA:397,3279 +DA:399,3279 +BRDA:399,10,0,2199 +BRDA:399,10,1,3279 +DA:400,2199 FN:404,RecurringPaymentManager._isAuthorizedPaymentProcessor -FNDA:3261,RecurringPaymentManager._isAuthorizedPaymentProcessor -DA:410,3261 +FNDA:3279,RecurringPaymentManager._isAuthorizedPaymentProcessor +DA:410,3279 FNF:17 FNH:14 LF:83 @@ -1863,8 +1632,8 @@ end_of_record TN: SF:src/modules/paymentProcessor/SimplePaymentProcessor.sol FN:52,SimplePaymentProcessor.init -FNDA:7,SimplePaymentProcessor.init -DA:57,6 +FNDA:8,SimplePaymentProcessor.init +DA:57,7 FN:64,SimplePaymentProcessor.token FNDA:1,SimplePaymentProcessor.token DA:65,260 @@ -1899,16 +1668,15 @@ FN:85,StreamingPaymentProcessor.init FNDA:257,StreamingPaymentProcessor.init DA:90,256 FN:94,StreamingPaymentProcessor.claimAll -FNDA:56002,StreamingPaymentProcessor.claimAll -DA:96,56002 -BRDA:95,0,0,10806 -BRDA:95,0,1,45196 -DA:102,10806 -DA:107,45196 +FNDA:43645,StreamingPaymentProcessor.claimAll +DA:96,43645 +BRDA:95,0,0,7800 +BRDA:95,0,1,35845 +DA:102,7800 +DA:107,35845 FN:111,StreamingPaymentProcessor.claimForSpecificWalletId FNDA:512,StreamingPaymentProcessor.claimForSpecificWalletId DA:117,512 -DA:118,512 BRDA:116,1,0,- BRDA:116,1,1,512 DA:120,0 @@ -1921,7 +1689,7 @@ FN:140,StreamingPaymentProcessor.processPayments FNDA:4356,StreamingPaymentProcessor.processPayments DA:146,3844 BRDA:146,3,0,- -BRDA:146,3,1,92379 +BRDA:146,3,1,73728 DA:148,3588 DA:149,3588 DA:150,3588 @@ -1936,14 +1704,14 @@ DA:161,3588 DA:162,3588 DA:164,3588 DA:166,3588 -DA:167,92379 -DA:168,92379 -DA:169,92379 -DA:170,92379 -DA:171,92379 -DA:173,92379 -DA:182,92379 -DA:192,92379 +DA:167,73728 +DA:168,73728 +DA:169,73728 +DA:170,73728 +DA:171,73728 +DA:173,73728 +DA:182,73728 +DA:192,73728 FN:199,StreamingPaymentProcessor.cancelRunningPayments FNDA:1024,StreamingPaymentProcessor.cancelRunningPayments DA:204,512 @@ -1958,35 +1726,33 @@ FN:224,StreamingPaymentProcessor.removePaymentForSpecificWalletId FNDA:512,StreamingPaymentProcessor.removePaymentForSpecificWalletId DA:231,512 DA:241,512 -DA:242,512 BRDA:240,6,0,512 BRDA:240,6,1,512 DA:246,512 FN:254,StreamingPaymentProcessor.isActivePaymentReceiver -FNDA:20988,StreamingPaymentProcessor.isActivePaymentReceiver -DA:259,20988 +FNDA:16132,StreamingPaymentProcessor.isActivePaymentReceiver +DA:259,16132 FN:263,StreamingPaymentProcessor.startForSpecificWalletId -FNDA:11888,StreamingPaymentProcessor.startForSpecificWalletId -DA:268,983564 +FNDA:7681,StreamingPaymentProcessor.startForSpecificWalletId +DA:268,954279 FN:272,StreamingPaymentProcessor.dueToForSpecificWalletId -FNDA:11888,StreamingPaymentProcessor.dueToForSpecificWalletId -DA:277,1076708 +FNDA:7681,StreamingPaymentProcessor.dueToForSpecificWalletId +DA:277,1023646 FN:281,StreamingPaymentProcessor.releasedForSpecificWalletId -FNDA:11888,StreamingPaymentProcessor.releasedForSpecificWalletId -DA:286,961792 +FNDA:7681,StreamingPaymentProcessor.releasedForSpecificWalletId +DA:286,938341 FN:290,StreamingPaymentProcessor.vestedAmountForSpecificWalletId -FNDA:21772,StreamingPaymentProcessor.vestedAmountForSpecificWalletId -DA:296,971676 +FNDA:15938,StreamingPaymentProcessor.vestedAmountForSpecificWalletId +DA:296,946598 FN:302,StreamingPaymentProcessor.releasableForSpecificWalletId -FNDA:879966,StreamingPaymentProcessor.releasableForSpecificWalletId -DA:307,949904 -DA:309,949904 +FNDA:877286,StreamingPaymentProcessor.releasableForSpecificWalletId +DA:307,930660 FN:313,StreamingPaymentProcessor.unclaimable FNDA:260,StreamingPaymentProcessor.unclaimable -DA:318,56264 +DA:318,43907 FN:322,StreamingPaymentProcessor.token FNDA:1,StreamingPaymentProcessor.token -DA:323,73527 +DA:323,56963 FN:327,StreamingPaymentProcessor.viewAllPaymentOrders FNDA:2560,StreamingPaymentProcessor.viewAllPaymentOrders DA:333,2560 @@ -1999,35 +1765,35 @@ DA:342,5376 DA:346,5376 DA:350,2560 FN:360,StreamingPaymentProcessor._afterClaimCleanup -FNDA:69678,StreamingPaymentProcessor._afterClaimCleanup -DA:366,69678 -DA:369,69678 -DA:375,69678 -BRDA:375,7,0,67886 -BRDA:375,7,1,69678 -DA:376,67886 -DA:383,69678 +FNDA:53114,StreamingPaymentProcessor._afterClaimCleanup +DA:366,53114 +DA:369,53114 +DA:375,53114 +BRDA:375,7,0,51322 +BRDA:375,7,1,53114 +DA:376,51322 +DA:383,53114 FN:392,StreamingPaymentProcessor._findAddressInActiveVestings -FNDA:160260,StreamingPaymentProcessor._findAddressInActiveVestings -DA:396,160260 -DA:398,160260 -DA:399,160260 -DA:400,4261898 -BRDA:400,8,0,70446 -BRDA:400,8,1,4191452 -DA:401,70446 -DA:404,4191452 -DA:407,89814 +FNDA:125045,StreamingPaymentProcessor._findAddressInActiveVestings +DA:396,125045 +DA:398,125045 +DA:399,125045 +DA:400,2537763 +BRDA:400,8,0,53882 +BRDA:400,8,1,2483881 +DA:401,53882 +DA:404,2483881 +DA:407,71163 FN:417,StreamingPaymentProcessor._findActiveWalletId -FNDA:70190,StreamingPaymentProcessor._findActiveWalletId -DA:422,70190 -DA:424,70190 -DA:426,70190 -DA:427,71214 -DA:428,71214 -BRDA:428,9,0,70190 +FNDA:53626,StreamingPaymentProcessor._findActiveWalletId +DA:422,53626 +DA:424,53626 +DA:426,53626 +DA:427,54650 +DA:428,54650 +BRDA:428,9,0,53626 BRDA:428,9,1,1024 -DA:429,70190 +DA:429,53626 DA:432,1024 DA:436,0 FN:443,StreamingPaymentProcessor._cancelRunningOrders @@ -2035,197 +1801,402 @@ FNDA:512,StreamingPaymentProcessor._cancelRunningOrders DA:444,512 DA:445,512 DA:447,512 -DA:448,23206 -DA:449,22694 -DA:452,22694 +DA:448,15993 +DA:449,15481 +DA:452,15481 FN:463,StreamingPaymentProcessor._removePayment -FNDA:22694,StreamingPaymentProcessor._removePayment -DA:464,22694 -DA:466,22694 -DA:468,22694 -DA:469,22694 -DA:470,45388 -DA:471,22694 -DA:472,22694 -DA:477,22694 -DA:478,22694 -BRDA:476,10,0,16289 -BRDA:476,10,1,22694 -DA:480,16289 -DA:484,22694 +FNDA:15481,StreamingPaymentProcessor._removePayment +DA:464,15481 +DA:466,15481 +DA:468,15481 +DA:469,15481 +DA:470,30962 +DA:471,15481 +DA:472,15481 +DA:477,15481 +BRDA:476,10,0,11113 +BRDA:476,10,1,15481 +DA:480,11113 +DA:484,15481 FN:495,StreamingPaymentProcessor._removePaymentForSpecificWalletId -FNDA:69678,StreamingPaymentProcessor._removePaymentForSpecificWalletId -DA:500,69678 -DA:501,69678 -DA:503,69678 +FNDA:53114,StreamingPaymentProcessor._removePaymentForSpecificWalletId +DA:500,53114 +DA:501,53114 +DA:503,53114 BRDA:503,11,0,- -BRDA:503,11,1,69678 +BRDA:503,11,1,53114 DA:504,0 -DA:512,69678 -DA:516,69678 +DA:512,53114 +DA:516,53114 FN:525,StreamingPaymentProcessor._removeVestingInformationForSpecificWalletId -FNDA:69678,StreamingPaymentProcessor._removeVestingInformationForSpecificWalletId -DA:530,69678 +FNDA:53114,StreamingPaymentProcessor._removeVestingInformationForSpecificWalletId +DA:530,53114 FN:538,StreamingPaymentProcessor._removePaymentReceiverFromActiveVestings -FNDA:67886,StreamingPaymentProcessor._removePaymentReceiverFromActiveVestings -DA:543,67886 -DA:544,67886 -DA:546,67886 +FNDA:51322,StreamingPaymentProcessor._removePaymentReceiverFromActiveVestings +DA:543,51322 +DA:544,51322 +DA:546,51322 BRDA:546,12,0,- -BRDA:546,12,1,67886 +BRDA:546,12,1,51322 DA:547,0 -DA:553,67886 -DA:554,67886 -DA:558,67886 +DA:553,51322 +DA:554,51322 +DA:558,51322 FN:570,StreamingPaymentProcessor._addPayment -FNDA:92379,StreamingPaymentProcessor._addPayment -DA:579,92379 -DA:580,92374 +FNDA:73728,StreamingPaymentProcessor._addPayment +DA:579,73728 BRDA:578,13,0,5 -BRDA:578,13,1,92374 +BRDA:578,13,1,73723 DA:582,5 -DA:586,92374 -DA:588,92374 -DA:594,92374 -BRDA:593,14,0,89814 -BRDA:593,14,1,92374 -DA:597,89814 -DA:600,92374 -DA:602,92374 +DA:586,73723 +DA:588,73723 +DA:594,73723 +BRDA:593,14,0,71163 +BRDA:593,14,1,73723 +DA:597,71163 +DA:600,73723 +DA:602,73723 FN:615,StreamingPaymentProcessor._claimAll -FNDA:45196,StreamingPaymentProcessor._claimAll -DA:616,45196 -DA:618,45196 -DA:620,45196 -DA:621,91416 -DA:622,46220 -DA:627,46220 +FNDA:35845,StreamingPaymentProcessor._claimAll +DA:616,35845 +DA:618,35845 +DA:620,35845 +DA:621,72714 +DA:622,36869 +DA:627,36869 FN:640,StreamingPaymentProcessor._claimForSpecificWalletId -FNDA:69938,StreamingPaymentProcessor._claimForSpecificWalletId -DA:646,69938 -DA:647,69938 -DA:648,69938 -DA:651,69938 -DA:652,68914 +FNDA:53374,StreamingPaymentProcessor._claimForSpecificWalletId +DA:646,53374 +DA:647,53374 +DA:648,53374 +DA:651,53374 BRDA:650,15,0,2 -BRDA:650,15,1,69938 +BRDA:650,15,1,53374 DA:654,2 DA:655,2 -DA:658,69938 -DA:660,69938 -DA:669,69938 -BRDA:669,16,0,69936 +DA:658,53374 +DA:660,53374 +DA:669,53374 +BRDA:669,16,0,53372 BRDA:669,16,1,2 -DA:670,69936 +DA:670,53372 DA:672,2 -DA:675,69938 -DA:676,69938 -DA:679,69938 -BRDA:679,17,0,52877 -BRDA:679,17,1,69938 -DA:680,52877 +DA:675,53374 +DA:676,53374 +DA:679,53374 +BRDA:679,17,0,41489 +BRDA:679,17,1,53374 +DA:680,41489 FN:690,StreamingPaymentProcessor._vestingAmountForSpecificWalletId -FNDA:971676,StreamingPaymentProcessor._vestingAmountForSpecificWalletId -DA:696,971676 -DA:698,971676 -DA:699,971676 -DA:700,971676 -DA:701,971676 -DA:703,971676 +FNDA:946598,StreamingPaymentProcessor._vestingAmountForSpecificWalletId +DA:696,946598 +DA:698,946598 +DA:699,946598 +DA:700,946598 +DA:701,946598 +DA:703,946598 BRDA:703,18,0,- -BRDA:703,18,1,971676 +BRDA:703,18,1,946598 DA:704,0 -DA:705,971676 -BRDA:705,19,0,127735 -BRDA:705,19,1,843941 -DA:706,127735 -DA:708,843941 +DA:705,946598 +BRDA:705,19,0,97905 +BRDA:705,19,1,848693 +DA:706,97905 +DA:708,848693 FN:716,StreamingPaymentProcessor.validAddress -FNDA:92379,StreamingPaymentProcessor.validAddress -DA:717,92379 +FNDA:73728,StreamingPaymentProcessor.validAddress +DA:717,73728 FN:726,StreamingPaymentProcessor.validSalary -FNDA:92375,StreamingPaymentProcessor.validSalary -DA:727,92375 +FNDA:73724,StreamingPaymentProcessor.validSalary +DA:727,73724 FN:733,StreamingPaymentProcessor.validStart -FNDA:92374,StreamingPaymentProcessor.validStart -DA:734,92374 +FNDA:73723,StreamingPaymentProcessor.validStart +DA:734,73723 FNF:31 FNH:30 -LF:152 -LH:142 +LF:146 +LH:136 BRF:40 BRH:31 end_of_record TN: +SF:src/modules/utils/MetadataManager.sol +FN:23,MetadataManager.init +FNDA:3,MetadataManager.init +DA:28,2 +DA:30,2 +DA:34,2 +DA:39,2 +DA:41,2 +DA:43,2 +FN:49,MetadataManager.getManagerMetadata +FNDA:7,MetadataManager.getManagerMetadata +DA:54,7 +FN:57,MetadataManager.getOrchestratorMetadata +FNDA:19,MetadataManager.getOrchestratorMetadata +DA:62,19 +FN:65,MetadataManager.getTeamMetadata +FNDA:6,MetadataManager.getTeamMetadata +DA:70,6 +FN:76,MetadataManager.setManagerMetadata +FNDA:1,MetadataManager.setManagerMetadata +DA:80,1 +FN:83,MetadataManager._setManagerMetadata +FNDA:3,MetadataManager._setManagerMetadata +DA:86,3 +DA:87,3 +FN:94,MetadataManager.setOrchestratorMetadata +FNDA:1,MetadataManager.setOrchestratorMetadata +DA:97,1 +FN:100,MetadataManager._setOrchestratorMetadata +FNDA:3,MetadataManager._setOrchestratorMetadata +DA:103,3 +DA:104,3 +FN:113,MetadataManager.setTeamMetadata +FNDA:1,MetadataManager.setTeamMetadata +DA:117,1 +FN:120,MetadataManager._setTeamMetadata +FNDA:3,MetadataManager._setTeamMetadata +DA:121,3 +DA:123,3 +DA:124,3 +DA:125,4 +DA:128,3 +FNF:10 +FNH:10 +LF:21 +LH:21 +BRF:0 +BRH:0 +end_of_record +TN: +SF:src/modules/utils/SingleVoteGovernor.sol +FN:75,SingleVoteGovernor.init +FNDA:517,SingleVoteGovernor.init +DA:80,517 +DA:84,517 +DA:85,517 +DA:86,517 +DA:87,517 +DA:90,517 +DA:93,517 +BRDA:93,0,0,1 +BRDA:93,0,1,516 +DA:94,1 +DA:99,516 +BRDA:99,1,0,- +BRDA:99,1,1,516 +DA:100,0 +DA:105,516 +BRDA:104,2,0,- +BRDA:104,2,1,516 +DA:108,0 +DA:112,516 +DA:113,516 +DA:114,6901 +DA:117,6901 +BRDA:116,3,0,3 +BRDA:116,3,1,6898 +DA:120,3 +DA:123,6898 +BRDA:123,4,0,256 +BRDA:123,4,1,6642 +DA:124,256 +DA:127,6642 +DA:128,6642 +DA:132,257 +DA:135,257 +DA:136,257 +DA:139,257 +DA:140,257 +FN:146,SingleVoteGovernor.getReceipt +FNDA:43218,SingleVoteGovernor.getReceipt +DA:151,43218 +DA:153,43218 +FN:159,SingleVoteGovernor.setThreshold +FNDA:5024,SingleVoteGovernor.setThreshold +DA:161,259 +BRDA:161,5,0,256 +BRDA:161,5,1,3 +DA:162,256 +DA:168,3 +DA:169,3 +FN:172,SingleVoteGovernor.setVotingDuration +FNDA:4814,SingleVoteGovernor.setVotingDuration +DA:175,6 +BRDA:174,6,0,2 +BRDA:174,6,1,4 +DA:178,2 +DA:181,4 +DA:182,4 +FN:188,SingleVoteGovernor.addVoter +FNDA:63086,SingleVoteGovernor.addVoter +DA:189,58193 +BRDA:189,7,0,52951 +BRDA:189,7,1,58193 +DA:190,52951 +DA:192,52951 +DA:194,52951 +FN:198,SingleVoteGovernor.removeVoter +FNDA:14158,SingleVoteGovernor.removeVoter +DA:200,9283 +BRDA:200,8,0,1 +BRDA:200,8,1,9282 +DA:201,1 +DA:205,9282 +BRDA:205,9,0,1 +BRDA:205,9,1,9281 +DA:206,1 +DA:209,9281 +BRDA:209,10,0,4642 +BRDA:209,10,1,9281 +DA:210,4642 +DA:212,4642 +DA:214,4642 +FN:221,SingleVoteGovernor.createMotion +FNDA:60202,SingleVoteGovernor.createMotion +DA:227,55025 +DA:231,55025 +DA:234,55025 +DA:235,55025 +DA:237,55025 +DA:238,55025 +DA:239,55025 +DA:241,55025 +DA:245,55025 +DA:248,55025 +FN:251,SingleVoteGovernor.castVote +FNDA:327462,SingleVoteGovernor.castVote +DA:256,312744 +BRDA:256,11,0,256 +BRDA:256,11,1,312488 +DA:257,256 +DA:261,312488 +BRDA:261,12,0,37506 +BRDA:261,12,1,274982 +DA:262,37506 +DA:266,274982 +DA:269,274982 +BRDA:269,13,0,92646 +BRDA:269,13,1,182336 +DA:270,92646 +DA:274,182336 +BRDA:274,14,0,13926 +BRDA:274,14,1,168410 +DA:275,13926 +DA:278,168410 +BRDA:278,15,0,153020 +BRDA:278,15,1,15390 +DA:280,153020 +DA:282,15390 +BRDA:282,16,0,10217 +BRDA:282,16,1,5173 +DA:284,10217 +DA:286,5173 +BRDA:286,17,0,5173 +BRDA:286,17,1,5173 +DA:288,5173 +DA:292,168410 +FN:295,SingleVoteGovernor.executeMotion +FNDA:47974,SingleVoteGovernor.executeMotion +DA:297,47974 +DA:300,47974 +BRDA:300,18,0,256 +BRDA:300,18,1,47718 +DA:301,256 +DA:305,47718 +BRDA:305,19,0,2 +BRDA:305,19,1,47716 +DA:306,2 +DA:310,47716 +BRDA:310,20,0,1 +BRDA:310,20,1,47715 +DA:311,1 +DA:315,47715 +BRDA:315,21,0,1 +BRDA:315,21,1,47714 +DA:316,1 +DA:320,47714 +DA:323,47714 +DA:324,47714 +DA:325,47714 +DA:328,47714 +DA:329,47714 +DA:331,47714 +FNF:9 +FNH:9 +LF:90 +LH:88 +BRF:44 +BRH:42 +end_of_record +TN: SF:src/orchestrator/Orchestrator.sol -FN:94,Orchestrator.init -FNDA:15443,Orchestrator.init -DA:104,15187 -DA:105,15187 -DA:108,15187 -DA:110,15187 -DA:112,15187 -DA:113,15187 -DA:114,15187 -DA:117,15187 -DA:122,15187 -DA:123,15187 -DA:124,15187 -FN:135,Orchestrator._isModuleUsedInOrchestrator +FN:96,Orchestrator.init +FNDA:15664,Orchestrator.init +DA:105,15408 +DA:108,15408 +DA:110,15408 +DA:112,15408 +DA:113,15408 +DA:114,15408 +DA:119,15408 +DA:120,15408 +DA:121,15408 +FN:132,Orchestrator._isModuleUsedInOrchestrator FNDA:0,Orchestrator._isModuleUsedInOrchestrator +DA:137,0 +DA:138,0 +DA:139,0 DA:140,0 -DA:141,0 DA:142,0 DA:143,0 DA:145,0 -DA:146,0 -DA:148,0 -BRDA:148,0,0,- -BRDA:148,0,1,- +BRDA:145,0,0,- +BRDA:145,0,1,- +DA:147,0 +BRDA:146,1,0,- +BRDA:146,1,1,- DA:150,0 -DA:151,0 -BRDA:149,1,0,- -BRDA:149,1,1,- -DA:153,0 -DA:158,0 -DA:162,0 -FN:166,Orchestrator.findModuleAddressInOrchestrator +DA:155,0 +DA:159,0 +FN:163,Orchestrator.findModuleAddressInOrchestrator FNDA:0,Orchestrator.findModuleAddressInOrchestrator +DA:168,0 +DA:169,0 +DA:170,0 +BRDA:170,2,0,- +BRDA:170,2,1,- DA:171,0 -DA:172,0 -DA:173,0 -BRDA:173,2,0,- -BRDA:173,2,1,- DA:174,0 -DA:177,0 -FN:187,Orchestrator.verifyAddressIsAuthorizerModule +FN:184,Orchestrator.verifyAddressIsAuthorizerModule FNDA:0,Orchestrator.verifyAddressIsAuthorizerModule -DA:192,0 -DA:194,0 -FN:203,Orchestrator.verifyAddressIsFundingManager +DA:189,0 +DA:191,0 +FN:200,Orchestrator.verifyAddressIsFundingManager FNDA:0,Orchestrator.verifyAddressIsFundingManager +DA:205,0 +DA:206,0 DA:208,0 -DA:209,0 -DA:211,0 -FN:219,Orchestrator.verifyAddressIsMilestoneManager +FN:216,Orchestrator.verifyAddressIsMilestoneManager FNDA:0,Orchestrator.verifyAddressIsMilestoneManager +DA:221,0 +DA:222,0 DA:224,0 -DA:225,0 -DA:227,0 -FN:235,Orchestrator.verifyAddressIsRecurringPaymentManager +FN:232,Orchestrator.verifyAddressIsRecurringPaymentManager FNDA:0,Orchestrator.verifyAddressIsRecurringPaymentManager +DA:235,0 +DA:236,0 DA:238,0 -DA:239,0 -DA:241,0 -FN:249,Orchestrator.verifyAddressIsPaymentProcessor +FN:246,Orchestrator.verifyAddressIsPaymentProcessor FNDA:0,Orchestrator.verifyAddressIsPaymentProcessor +DA:251,0 +DA:252,0 DA:254,0 -DA:255,0 -DA:257,0 -FN:269,Orchestrator.__ModuleManager_isAuthorized +FN:266,Orchestrator.__ModuleManager_isAuthorized FNDA:1586,Orchestrator.__ModuleManager_isAuthorized -DA:275,1586 -FN:282,Orchestrator.setAuthorizer +DA:272,1586 +FN:279,Orchestrator.setAuthorizer FNDA:257,Orchestrator.setAuthorizer DA:283,257 DA:284,257 @@ -2254,208 +2225,184 @@ BRDA:321,3,1,256 DA:322,256 DA:324,256 FN:332,Orchestrator.token -FNDA:212591,Orchestrator.token -DA:333,212591 +FNDA:207485,Orchestrator.token +DA:333,207485 FN:337,Orchestrator.version FNDA:1,Orchestrator.version DA:338,1 -FN:341,Orchestrator.owner -FNDA:0,Orchestrator.owner -DA:347,4357 -FN:350,Orchestrator.manager -FNDA:4357,Orchestrator.manager -DA:351,4357 -FNF:17 -FNH:9 -LF:65 -LH:34 +FNF:15 +FNH:8 +LF:60 +LH:30 BRF:8 BRH:2 end_of_record TN: SF:src/orchestrator/base/ModuleManager.sol FN:101,ModuleManager.__ModuleManager_init -FNDA:17240,ModuleManager.__ModuleManager_init -DA:105,17239 -DA:107,17239 -DA:108,17239 -DA:112,17239 -BRDA:112,0,0,261 -BRDA:112,0,1,16978 -DA:113,261 -DA:116,16978 -DA:117,174932 -DA:119,174932 +FNDA:15925,ModuleManager.__ModuleManager_init +DA:105,15924 +DA:107,15924 +DA:108,15924 +DA:112,15924 +BRDA:112,0,0,257 +BRDA:112,0,1,15667 +DA:113,257 +DA:116,15667 +DA:117,162037 +DA:119,162037 FN:123,ModuleManager.__ModuleManager_addModule -FNDA:220493,ModuleManager.__ModuleManager_addModule -DA:128,220489 -FN:147,ModuleManager.hasRole -FNDA:1024,ModuleManager.hasRole -DA:152,2560 -FN:156,ModuleManager.isModule -FNDA:103479,ModuleManager.isModule -DA:162,479366 -FN:166,ModuleManager.listModules -FNDA:1277,ModuleManager.listModules -DA:167,1277 -FN:171,ModuleManager.modulesSize +FNDA:208261,ModuleManager.__ModuleManager_addModule +DA:128,208257 +FN:147,ModuleManager.isModule +FNDA:101122,ModuleManager.isModule +DA:153,456266 +FN:157,ModuleManager.listModules +FNDA:1282,ModuleManager.listModules +DA:158,1282 +FN:162,ModuleManager.modulesSize FNDA:0,ModuleManager.modulesSize -DA:172,0 -FN:179,ModuleManager.addModule -FNDA:82396,ModuleManager.addModule -DA:186,82396 -FN:190,ModuleManager.removeModule -FNDA:33843,ModuleManager.removeModule -DA:195,34102 -FN:202,ModuleManager.executeTxFromModule -FNDA:34029,ModuleManager.executeTxFromModule -DA:208,34028 -DA:209,34028 -DA:211,34028 -DA:213,34028 -FN:217,ModuleManager.grantRole -FNDA:1280,ModuleManager.grantRole -DA:218,1024 -BRDA:218,1,0,1024 -BRDA:218,1,1,1024 -DA:219,1024 -DA:220,1024 -FN:225,ModuleManager.revokeRole -FNDA:512,ModuleManager.revokeRole -DA:226,256 -BRDA:226,2,0,256 -BRDA:226,2,1,256 -DA:227,256 -DA:228,256 -FN:236,ModuleManager.renounceRole -FNDA:256,ModuleManager.renounceRole -DA:237,256 -BRDA:237,3,0,256 -BRDA:237,3,1,256 -DA:238,256 -DA:239,256 -FN:248,ModuleManager._commitAddModule -FNDA:302885,ModuleManager._commitAddModule -DA:250,302885 -DA:251,302885 -DA:252,302885 -FN:257,ModuleManager._commitRemoveModule -FNDA:34102,ModuleManager._commitRemoveModule -DA:264,34102 -DA:266,34102 -DA:268,34102 -DA:269,34102 -DA:270,1115544 -BRDA:270,4,0,34102 -BRDA:270,4,1,1081442 -DA:271,34102 -DA:272,34102 -DA:277,34102 -DA:279,34102 -DA:281,34102 -DA:283,34102 -FN:286,ModuleManager._ensureValidModule -FNDA:302891,ModuleManager._ensureValidModule -DA:287,302891 -BRDA:287,5,0,6 -BRDA:287,5,1,302885 -DA:288,6 -FN:292,ModuleManager._ensureNotModule -FNDA:303148,ModuleManager._ensureNotModule -DA:293,303148 -BRDA:293,6,0,257 -BRDA:293,6,1,302891 -DA:294,257 -FNF:16 -FNH:15 -LF:46 -LH:45 -BRF:14 -BRH:14 +DA:163,0 +FN:170,ModuleManager.addModule +FNDA:80594,ModuleManager.addModule +DA:177,80594 +FN:181,ModuleManager.removeModule +FNDA:31663,ModuleManager.removeModule +DA:186,31922 +FN:193,ModuleManager.executeTxFromModule +FNDA:33852,ModuleManager.executeTxFromModule +DA:199,33851 +DA:200,33851 +DA:202,33851 +DA:204,33851 +FN:212,ModuleManager._commitAddModule +FNDA:288851,ModuleManager._commitAddModule +DA:214,288851 +DA:215,288851 +DA:216,288851 +FN:221,ModuleManager._commitRemoveModule +FNDA:31922,ModuleManager._commitRemoveModule +DA:228,31922 +DA:230,31922 +DA:232,31922 +DA:233,31922 +DA:234,1041383 +BRDA:234,1,0,31922 +BRDA:234,1,1,1009461 +DA:235,31922 +DA:236,31922 +DA:241,31922 +DA:243,31922 +DA:245,31922 +DA:247,31922 +FN:250,ModuleManager._ensureValidModule +FNDA:288857,ModuleManager._ensureValidModule +DA:251,288857 +BRDA:251,2,0,6 +BRDA:251,2,1,288851 +DA:252,6 +FN:256,ModuleManager._ensureNotModule +FNDA:289114,ModuleManager._ensureNotModule +DA:257,289114 +BRDA:257,3,0,257 +BRDA:257,3,1,288857 +DA:258,257 +FNF:12 +FNH:11 +LF:36 +LH:35 +BRF:8 +BRH:8 end_of_record TN: SF:test/e2e/E2eTest.sol -FN:173,E2eTest.setUp +FN:195,E2eTest.setUp FNDA:0,E2eTest.setUp -DA:175,0 -DA:178,0 -DA:179,0 -DA:180,0 -DA:181,0 -DA:182,0 -DA:183,0 -DA:184,0 -DA:185,0 -DA:188,0 -DA:189,0 -DA:190,0 -DA:191,0 -DA:192,0 -DA:193,0 -DA:194,0 -DA:195,0 -DA:196,0 DA:197,0 -DA:198,0 -DA:199,0 DA:200,0 DA:201,0 DA:202,0 DA:203,0 +DA:204,0 +DA:205,0 DA:206,0 DA:207,0 -DA:210,0 +DA:208,0 DA:211,0 DA:212,0 DA:213,0 +DA:214,0 +DA:215,0 DA:216,0 DA:217,0 DA:218,0 DA:219,0 DA:220,0 DA:221,0 +DA:222,0 +DA:223,0 DA:224,0 DA:225,0 DA:226,0 DA:227,0 -DA:230,0 +DA:228,0 DA:231,0 +DA:232,0 DA:235,0 -DA:239,0 +DA:236,0 +DA:237,0 +DA:238,0 +DA:241,0 DA:242,0 +DA:243,0 +DA:244,0 +DA:245,0 DA:246,0 DA:249,0 +DA:250,0 DA:252,0 +DA:253,0 +DA:255,0 DA:256,0 DA:259,0 -FN:264,E2eTest._createNewOrchestratorWithAllModules -FNDA:0,E2eTest._createNewOrchestratorWithAllModules -DA:267,0 +DA:260,0 +DA:264,0 DA:268,0 -DA:269,0 -DA:270,0 -DA:272,0 -DA:273,0 -DA:280,0 -FN:289,E2eTest._createNewOrchestratorWithAllModules_withRecurringPaymentManagerAndStreamingPaymentProcessor -FNDA:0,E2eTest._createNewOrchestratorWithAllModules_withRecurringPaymentManagerAndStreamingPaymentProcessor -DA:292,0 -DA:293,0 -DA:294,0 -DA:296,0 -DA:297,0 +DA:271,0 +DA:275,0 +DA:278,0 +DA:281,0 +DA:285,0 +DA:288,0 +DA:291,0 +FN:296,E2eTest._createNewOrchestratorWithAllModules +FNDA:0,E2eTest._createNewOrchestratorWithAllModules +DA:299,0 +DA:300,0 +DA:301,0 +DA:302,0 DA:304,0 -FN:313,E2eTest._createNewOrchestratorWithAllModules_withRoleBasedAuthorizerAndBountyManager -FNDA:0,E2eTest._createNewOrchestratorWithAllModules_withRoleBasedAuthorizerAndBountyManager -DA:316,0 -DA:317,0 -DA:318,0 -DA:320,0 -DA:321,0 +DA:305,0 +DA:312,0 +FN:321,E2eTest._createNewOrchestratorWithAllModules_withRecurringPaymentManagerAndStreamingPaymentProcessor +FNDA:0,E2eTest._createNewOrchestratorWithAllModules_withRecurringPaymentManagerAndStreamingPaymentProcessor +DA:324,0 +DA:325,0 +DA:326,0 DA:328,0 +DA:329,0 +DA:336,0 +FN:345,E2eTest._createNewOrchestratorWithAllModules_withRoleBasedAuthorizerAndBountyManager +FNDA:0,E2eTest._createNewOrchestratorWithAllModules_withRoleBasedAuthorizerAndBountyManager +DA:348,0 +DA:349,0 +DA:350,0 +DA:352,0 +DA:353,0 +DA:360,0 FNF:4 FNH:0 -LF:70 +LF:76 LH:0 BRF:0 BRH:0 @@ -2469,32 +2416,32 @@ DA:55,0 DA:57,0 DA:58,0 DA:60,0 -DA:69,0 -FN:86,ModuleTest._expectOrchestratorCallbackFailure +DA:68,0 +FN:85,ModuleTest._expectOrchestratorCallbackFailure FNDA:0,ModuleTest._expectOrchestratorCallbackFailure -DA:89,0 -FN:109,ModuleTest._assumeNonEmptyString +DA:88,0 +FN:108,ModuleTest._assumeNonEmptyString FNDA:0,ModuleTest._assumeNonEmptyString -DA:110,0 -FN:113,ModuleTest._assumeTimestampNotInPast +DA:109,0 +FN:112,ModuleTest._assumeTimestampNotInPast FNDA:0,ModuleTest._assumeTimestampNotInPast -DA:114,0 -FN:119,ModuleTest._assumeElemNotInSet +DA:113,0 +FN:118,ModuleTest._assumeElemNotInSet FNDA:0,ModuleTest._assumeElemNotInSet +DA:122,0 DA:123,0 -DA:124,0 -FN:128,ModuleTest._assumeElemNotInSet +FN:127,ModuleTest._assumeElemNotInSet FNDA:0,ModuleTest._assumeElemNotInSet +DA:128,0 DA:129,0 -DA:130,0 -FN:134,ModuleTest._assumeElemNotInSet +FN:133,ModuleTest._assumeElemNotInSet FNDA:0,ModuleTest._assumeElemNotInSet +DA:137,0 DA:138,0 -DA:139,0 -FN:143,ModuleTest._assumeElemNotInSet +FN:142,ModuleTest._assumeElemNotInSet FNDA:0,ModuleTest._assumeElemNotInSet +DA:146,0 DA:147,0 -DA:148,0 FNF:8 FNH:0 LF:17 @@ -2514,12 +2461,12 @@ DA:45,0 DA:46,0 DA:47,0 DA:48,0 +DA:57,0 DA:58,0 -DA:59,0 -DA:61,0 -DA:66,0 -DA:72,0 -DA:76,0 +DA:60,0 +DA:65,0 +DA:69,0 +DA:70,0 FNF:1 FNH:0 LF:14 @@ -2557,8 +2504,8 @@ end_of_record TN: SF:test/modules/fundingManager/token/utils/mocks/ERC20Mock.sol FN:13,ERC20Mock.mint -FNDA:3429,ERC20Mock.mint -DA:14,3429 +FNDA:3607,ERC20Mock.mint +DA:14,3607 FN:17,ERC20Mock.burn FNDA:267,ERC20Mock.burn DA:18,267 @@ -2572,15 +2519,15 @@ end_of_record TN: SF:test/modules/fundingManager/token/utils/mocks/ElasticReceiptTokenBaseMock.sol FN:28,ElasticReceiptTokenBaseMock._supplyTarget -FNDA:6511,ElasticReceiptTokenBaseMock._supplyTarget -DA:34,6511 +FNDA:6536,ElasticReceiptTokenBaseMock._supplyTarget +DA:34,6536 FN:37,ElasticReceiptTokenBaseMock.mint FNDA:3338,ElasticReceiptTokenBaseMock.mint DA:38,3338 -DA:39,2946 +DA:39,2954 FN:42,ElasticReceiptTokenBaseMock.burn -FNDA:163,ElasticReceiptTokenBaseMock.burn -DA:43,163 +FNDA:154,ElasticReceiptTokenBaseMock.burn +DA:43,154 DA:44,0 FNF:3 FNH:3 @@ -2612,16 +2559,16 @@ end_of_record TN: SF:test/modules/fundingManager/token/utils/mocks/ElasticReceiptTokenUpgradeableMock.sol FN:18,ElasticReceiptTokenUpgradeableMock.init -FNDA:83,ElasticReceiptTokenUpgradeableMock.init -DA:24,83 +FNDA:261,ElasticReceiptTokenUpgradeableMock.init +DA:24,261 DA:26,5 FN:29,ElasticReceiptTokenUpgradeableMock._supplyTarget -FNDA:78,ElasticReceiptTokenUpgradeableMock._supplyTarget -DA:35,78 +FNDA:256,ElasticReceiptTokenUpgradeableMock._supplyTarget +DA:35,256 FN:38,ElasticReceiptTokenUpgradeableMock.mint -FNDA:78,ElasticReceiptTokenUpgradeableMock.mint -DA:39,78 -DA:40,78 +FNDA:256,ElasticReceiptTokenUpgradeableMock.mint +DA:39,256 +DA:40,256 FN:43,ElasticReceiptTokenUpgradeableMock.burn FNDA:0,ElasticReceiptTokenUpgradeableMock.burn DA:44,0 @@ -2638,7 +2585,7 @@ SF:test/orchestrator/helper/TypeSanityHelper.sol FN:16,TypeSanityHelper.assumeElemNotInSet FNDA:8960,TypeSanityHelper.assumeElemNotInSet DA:20,8960 -DA:21,625411 +DA:21,579616 FN:29,TypeSanityHelper.assumeValidOrchestratorId FNDA:2048,TypeSanityHelper.assumeValidOrchestratorId DA:30,2048 @@ -2646,20 +2593,20 @@ FN:41,TypeSanityHelper.assumeValidModules FNDA:3072,TypeSanityHelper.assumeValidModules DA:42,3072 DA:43,3072 -DA:44,226380 -DA:47,226380 -DA:50,226380 +DA:44,214037 +DA:47,214037 +DA:50,214037 FN:54,TypeSanityHelper.assumeValidModule -FNDA:2560,TypeSanityHelper.assumeValidModule -DA:55,228940 -DA:57,228940 -DA:58,686820 +FNDA:1024,TypeSanityHelper.assumeValidModule +DA:55,215061 +DA:57,215061 +DA:58,645183 FN:62,TypeSanityHelper.createInvalidModules FNDA:2,TypeSanityHelper.createInvalidModules -DA:63,228942 -DA:65,228942 -DA:66,228942 -DA:68,228942 +DA:63,215063 +DA:65,215063 +DA:66,215063 +DA:68,215063 FN:75,TypeSanityHelper.assumeValidFunders FNDA:0,TypeSanityHelper.assumeValidFunders FNF:6 @@ -2672,11 +2619,11 @@ end_of_record TN: SF:test/utils/mocks/ERC20Mock.sol FN:14,ERC20Mock.mint -FNDA:139782,ERC20Mock.mint -DA:15,139782 +FNDA:123234,ERC20Mock.mint +DA:15,123234 FN:18,ERC20Mock.burn -FNDA:27829,ERC20Mock.burn -DA:19,27829 +FNDA:27217,ERC20Mock.burn +DA:19,27217 FN:22,ERC20Mock.blockAddress FNDA:1,ERC20Mock.blockAddress DA:23,1 @@ -2688,32 +2635,32 @@ FNDA:2,ERC20Mock.toggleReturnFalse DA:31,2 FN:34,ERC20Mock.isBlockedAddress FNDA:2,ERC20Mock.isBlockedAddress -DA:35,142149 +DA:35,129577 FN:38,ERC20Mock.transfer -FNDA:51890,ERC20Mock.transfer -DA:39,51890 +FNDA:52732,ERC20Mock.transfer +DA:39,52732 BRDA:39,0,0,- -BRDA:39,0,1,51890 +BRDA:39,0,1,52732 DA:40,0 -DA:42,51890 +DA:42,52732 BRDA:42,1,0,- -BRDA:42,1,1,51890 -DA:43,51890 -DA:44,51890 -DA:45,51634 +BRDA:42,1,1,52732 +DA:43,52732 +DA:44,52732 +DA:45,52476 FN:48,ERC20Mock.transferFrom -FNDA:90258,ERC20Mock.transferFrom -DA:53,90258 +FNDA:76844,ERC20Mock.transferFrom +DA:53,76844 BRDA:53,2,0,1 -BRDA:53,2,1,90257 +BRDA:53,2,1,76843 DA:54,1 -DA:56,90257 +DA:56,76843 BRDA:56,3,0,1 -BRDA:56,3,1,90256 -DA:57,90256 -DA:58,90256 -DA:59,90256 -DA:60,90256 +BRDA:56,3,1,76842 +DA:57,76842 +DA:58,76842 +DA:59,76842 +DA:60,76842 FNF:8 FNH:8 LF:19 @@ -2724,12 +2671,12 @@ end_of_record TN: SF:test/utils/mocks/ERC721Mock.sol FN:15,ERC721Mock.mint -FNDA:1863,ERC721Mock.mint -DA:16,1863 -DA:17,1863 +FNDA:1725,ERC721Mock.mint +DA:16,1725 +DA:17,1725 FN:20,ERC721Mock.burn -FNDA:2119,ERC721Mock.burn -DA:21,2119 +FNDA:1981,ERC721Mock.burn +DA:21,1981 FN:24,ERC721Mock.blockAddress FNDA:0,ERC721Mock.blockAddress DA:25,0 @@ -2755,8 +2702,8 @@ end_of_record TN: SF:test/utils/mocks/factories/ModuleFactoryMock.sol FN:20,ModuleFactoryMock.createModule -FNDA:50554,ModuleFactoryMock.createModule -DA:24,50554 +FNDA:50848,ModuleFactoryMock.createModule +DA:24,50848 FN:27,ModuleFactoryMock.getBeaconAndId FNDA:0,ModuleFactoryMock.getBeaconAndId DA:32,0 @@ -2813,70 +2760,92 @@ BRH:0 end_of_record TN: SF:test/utils/mocks/modules/AuthorizerMock.sol -FN:15,AuthorizerMock.setIsAuthorized -FNDA:3523,AuthorizerMock.setIsAuthorized -DA:16,3523 -FN:19,AuthorizerMock.setAllAuthorized +FN:16,AuthorizerMock.setIsAuthorized +FNDA:3334,AuthorizerMock.setIsAuthorized +DA:17,3334 +FN:20,AuthorizerMock.setAllAuthorized FNDA:0,AuthorizerMock.setAllAuthorized -DA:20,0 -FN:26,AuthorizerMock.init -FNDA:258,AuthorizerMock.init -DA:31,258 -DA:34,258 +DA:21,0 +FN:27,AuthorizerMock.init +FNDA:259,AuthorizerMock.init +DA:32,258 DA:35,258 -BRDA:35,0,0,- -BRDA:35,0,1,258 -DA:37,258 -FN:40,AuthorizerMock.mockInit +DA:36,258 +BRDA:36,0,0,- +BRDA:36,0,1,258 +DA:38,258 +DA:40,258 +DA:42,258 +FN:46,AuthorizerMock.mockInit FNDA:256,AuthorizerMock.mockInit -DA:42,256 -DA:43,256 -BRDA:43,1,0,- -BRDA:43,1,1,256 -DA:45,256 -FN:51,AuthorizerMock.isAuthorized -FNDA:245863,AuthorizerMock.isAuthorized -DA:52,245863 -FN:57,AuthorizerMock.isAuthorized -FNDA:294444,AuthorizerMock.isAuthorized -DA:62,294444 -FN:67,AuthorizerMock.generateRoleId -FNDA:0,AuthorizerMock.generateRoleId -DA:72,1474 -FN:75,AuthorizerMock.grantRoleFromModule +DA:48,256 +DA:49,256 +BRDA:49,1,0,- +BRDA:49,1,1,256 +DA:51,256 +FN:58,AuthorizerMock.isAuthorized +FNDA:3844,AuthorizerMock.isAuthorized +DA:59,3844 +FN:65,AuthorizerMock.isAuthorized +FNDA:298858,AuthorizerMock.isAuthorized +DA:70,298858 +FN:77,AuthorizerMock.generateRoleId +FNDA:512,AuthorizerMock.generateRoleId +DA:82,473819 +FN:85,AuthorizerMock.grantRoleFromModule FNDA:512,AuthorizerMock.grantRoleFromModule -DA:76,512 -FN:79,AuthorizerMock.revokeRoleFromModule +DA:86,512 +DA:87,512 +FN:90,AuthorizerMock.revokeRoleFromModule FNDA:256,AuthorizerMock.revokeRoleFromModule -DA:80,256 -FN:83,AuthorizerMock.toggleModuleSelfManagement -FNDA:2,AuthorizerMock.toggleModuleSelfManagement -FN:85,AuthorizerMock.transferAdminRole +DA:91,256 +FN:94,AuthorizerMock.toggleModuleSelfManagement +FNDA:514,AuthorizerMock.toggleModuleSelfManagement +FN:96,AuthorizerMock.transferAdminRole FNDA:0,AuthorizerMock.transferAdminRole -FN:87,AuthorizerMock.burnAdminRole +FN:98,AuthorizerMock.burnAdminRole FNDA:0,AuthorizerMock.burnAdminRole -FN:91,AuthorizerMock.getRoleAdmin +FN:102,AuthorizerMock.getRoleAdmin FNDA:0,AuthorizerMock.getRoleAdmin -DA:92,0 -FN:95,AuthorizerMock.getRoleMember +DA:103,0 +FN:106,AuthorizerMock.getRoleMember FNDA:0,AuthorizerMock.getRoleMember -DA:96,0 -FN:99,AuthorizerMock.getRoleMemberCount +DA:107,0 +FN:110,AuthorizerMock.getRoleMemberCount FNDA:0,AuthorizerMock.getRoleMemberCount -DA:100,0 -FN:103,AuthorizerMock.grantRole +DA:111,0 +FN:114,AuthorizerMock.grantRole FNDA:0,AuthorizerMock.grantRole -FN:105,AuthorizerMock.hasRole -FNDA:0,AuthorizerMock.hasRole -DA:106,0 -FN:109,AuthorizerMock.revokeRole +DA:115,0 +FN:118,AuthorizerMock.hasRole +FNDA:238948,AuthorizerMock.hasRole +DA:119,238948 +FN:122,AuthorizerMock.checkRoleMembership +FNDA:512,AuthorizerMock.checkRoleMembership +DA:127,512 +FN:130,AuthorizerMock.revokeRole FNDA:0,AuthorizerMock.revokeRole -FN:111,AuthorizerMock.renounceRole +DA:131,0 +FN:134,AuthorizerMock.renounceRole FNDA:0,AuthorizerMock.renounceRole -FNF:19 -FNH:8 -LF:18 -LH:13 +FN:136,AuthorizerMock.getOwnerRole +FNDA:235362,AuthorizerMock.getOwnerRole +DA:137,235362 +FN:140,AuthorizerMock.getManagerRole +FNDA:235874,AuthorizerMock.getManagerRole +DA:141,235874 +FN:148,AuthorizerMock.grantGlobalRole +FNDA:0,AuthorizerMock.grantGlobalRole +DA:149,0 +DA:150,0 +FN:157,AuthorizerMock.revokeGlobalRole +FNDA:0,AuthorizerMock.revokeGlobalRole +DA:158,0 +DA:159,0 +FNF:24 +FNH:13 +LF:30 +LH:20 BRF:4 BRH:2 end_of_record @@ -2904,8 +2873,8 @@ FN:47,FundingManagerMock.withdrawTo FNDA:0,FundingManagerMock.withdrawTo DA:48,0 FN:51,FundingManagerMock.transferOrchestratorToken -FNDA:33764,FundingManagerMock.transferOrchestratorToken -DA:52,33764 +FNDA:33587,FundingManagerMock.transferOrchestratorToken +DA:52,33587 FNF:8 FNH:3 LF:8 @@ -2916,15 +2885,15 @@ end_of_record TN: SF:test/utils/mocks/modules/PaymentProcessorMock.sol FN:15,PaymentProcessorMock.processPayments -FNDA:22107,PaymentProcessorMock.processPayments +FNDA:22298,PaymentProcessorMock.processPayments FN:17,PaymentProcessorMock.cancelRunningPayments FNDA:768,PaymentProcessorMock.cancelRunningPayments FN:19,PaymentProcessorMock.token FNDA:0,PaymentProcessorMock.token DA:20,0 FN:23,PaymentProcessorMock.deleteAllPayments -FNDA:3005,PaymentProcessorMock.deleteAllPayments -DA:24,3005 +FNDA:3023,PaymentProcessorMock.deleteAllPayments +DA:24,3023 FNF:4 FNH:3 LF:2 @@ -2953,8 +2922,8 @@ FN:29,ERC20PaymentClientMock.setIsAuthorized FNDA:1,ERC20PaymentClientMock.setIsAuthorized DA:30,1 FN:36,ERC20PaymentClientMock.addPaymentOrder -FNDA:91097,ERC20PaymentClientMock.addPaymentOrder -DA:37,91097 +FNDA:72446,ERC20PaymentClientMock.addPaymentOrder +DA:37,72446 FN:41,ERC20PaymentClientMock.addPaymentOrderUnchecked FNDA:5,ERC20PaymentClientMock.addPaymentOrderUnchecked DA:43,5 @@ -2965,13 +2934,13 @@ FN:55,ERC20PaymentClientMock.addPaymentOrders FNDA:1,ERC20PaymentClientMock.addPaymentOrders DA:56,1 FN:62,ERC20PaymentClientMock._ensureTokenBalance -FNDA:94944,ERC20PaymentClientMock._ensureTokenBalance -DA:66,94944 -BRDA:66,0,0,90592 -BRDA:66,0,1,94944 -DA:67,94944 -DA:69,90592 -DA:70,90592 +FNDA:76293,ERC20PaymentClientMock._ensureTokenBalance +DA:66,76293 +BRDA:66,0,0,71977 +BRDA:66,0,1,76293 +DA:67,76293 +DA:69,71977 +DA:70,71977 FN:74,ERC20PaymentClientMock._ensureTokenAllowance FNDA:3844,ERC20PaymentClientMock._ensureTokenAllowance DA:78,3844 @@ -2988,20 +2957,20 @@ end_of_record TN: SF:test/utils/mocks/orchestrator/base/ModuleManagerMock.sol FN:15,ModuleManagerMock.__ModuleManager_setIsAuthorized -FNDA:768,ModuleManagerMock.__ModuleManager_setIsAuthorized -DA:16,768 +FNDA:512,ModuleManagerMock.__ModuleManager_setIsAuthorized +DA:16,512 FN:19,ModuleManagerMock.__ModuleManager_setAllAuthorized FNDA:0,ModuleManagerMock.__ModuleManager_setAllAuthorized DA:20,0 FN:23,ModuleManagerMock.init -FNDA:2053,ModuleManagerMock.init -DA:24,2052 +FNDA:517,ModuleManagerMock.init +DA:24,516 FN:28,ModuleManagerMock.initNoInitializer FNDA:1,ModuleManagerMock.initNoInitializer DA:29,1 FN:32,ModuleManagerMock.__ModuleManager_isAuthorized -FNDA:116195,ModuleManagerMock.__ModuleManager_isAuthorized -DA:38,116195 +FNDA:112213,ModuleManagerMock.__ModuleManager_isAuthorized +DA:38,112213 FNF:5 FNH:4 LF:5 From e135e288194099a8b961d8700ab7f331a6303f7e Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Fri, 4 Aug 2023 18:04:13 +0200 Subject: [PATCH 18/32] remove comment --- test/modules/base/Module.t.sol | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/test/modules/base/Module.t.sol b/test/modules/base/Module.t.sol index 93e6c266d..b7250367b 100644 --- a/test/modules/base/Module.t.sol +++ b/test/modules/base/Module.t.sol @@ -46,33 +46,6 @@ contract baseModuleTest is ModuleTest { bytes _CONFIGDATA = bytes(""); function setUp() public { - /*//fundingManager = new FundingManagerMock(); - - //_authorizer = new AuthorizerMock(); - //_authorizer.setAllAuthorized(true); - - //paymentProcessor = new PaymentProcessorMock(); - - address orchestratorImpl = address(new Orchestrator()); - orchestrator = Orchestrator(Clones.clone(orchestratorImpl)); - - address impl = address(new ModuleMock()); - module = ModuleMock(Clones.clone(impl)); - - module.init(orchestrator, _METADATA, _CONFIGDATA); - - // Initialize orchestrator to enable module. - address[] memory modules = new address[](1); - modules[0] = address(module); - orchestrator.init( - 1, - IERC20(new ERC20Mock("Mock", "MOCK")), - modules, - fundingManager, - _authorizer, - paymentProcessor - );*/ - address impl = address(new ModuleMock()); module = ModuleMock(Clones.clone(impl)); From a93080bb4d846c806d25725e097eca75f2a63999 Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Tue, 8 Aug 2023 09:34:12 +0200 Subject: [PATCH 19/32] correct documentation typo --- src/modules/authorizer/RoleAuthorizer.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/authorizer/RoleAuthorizer.sol b/src/modules/authorizer/RoleAuthorizer.sol index 63f1efd55..ce03c7dc0 100644 --- a/src/modules/authorizer/RoleAuthorizer.sol +++ b/src/modules/authorizer/RoleAuthorizer.sol @@ -19,8 +19,8 @@ contract RoleAuthorizer is // Core roles for a orchestrator. They correspond to uint8(0) and uint(1) // NOTE that orchestrator owner can register more global roles using numbers from 2 onward. They'l need to go through the DEFAULT_ADMIN_ROLE for this. enum CoreRoles { - OWNER, // Partial Access to Protected Functions - MANAGER // Full Access to Protected Functions + OWNER, // Full Access to Protected Functions + MANAGER // Partial Access to Protected Functions } // Stores the if a module wants to use it's own roles From 974d0191c3ea3af401e75e8918d83320c509e48a Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Wed, 9 Aug 2023 08:01:39 +0200 Subject: [PATCH 20/32] more review fixes --- src/modules/authorizer/IAuthorizer.sol | 2 +- .../authorizer/TokenGatedRoleAuthorizer.sol | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/modules/authorizer/IAuthorizer.sol b/src/modules/authorizer/IAuthorizer.sol index ba9a0ea55..b73795e86 100644 --- a/src/modules/authorizer/IAuthorizer.sol +++ b/src/modules/authorizer/IAuthorizer.sol @@ -28,7 +28,7 @@ interface IAuthorizer is IAccessControlEnumerableUpgradeable { //-------------------------------------------------------------------------- // Overloaded and overriden functions - /// @notice Returns if an address is authorized to perform a specific action + /// @notice Returns if an address has the Orchestrator Owner Role /// @param who The adress to be checked. function isAuthorized(address who) external view returns (bool); diff --git a/src/modules/authorizer/TokenGatedRoleAuthorizer.sol b/src/modules/authorizer/TokenGatedRoleAuthorizer.sol index e35dcf5cc..5c08bc24a 100644 --- a/src/modules/authorizer/TokenGatedRoleAuthorizer.sol +++ b/src/modules/authorizer/TokenGatedRoleAuthorizer.sol @@ -109,7 +109,8 @@ contract TokenGatedRoleAuthorizer is function hasTokenRole(bytes32 role, address who) public view - returns (bool) + onlyTokenGated(role) + returns (bool) { uint numberOfAllowedTokens = getRoleMemberCount(role); @@ -172,6 +173,17 @@ contract TokenGatedRoleAuthorizer is _setThreshold(roleId, token, threshold); } + /// @inheritdoc ITokenGatedRoleAuthorizer + function setThresholdFromModule(uint8 role, address token, uint threshold) + public + onlyModule(_msgSender()) + onlySelfManaged + { + //TODO write tests + bytes32 roleId = generateRoleId(_msgSender(), role); + _setThreshold(roleId, token, threshold); + } + //-------------------------------------------------------------------------- // Setters for the Admin From 9d8581a4f5933fc61e76183560e48045b38eb749 Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Wed, 9 Aug 2023 08:17:52 +0200 Subject: [PATCH 21/32] allow for token gated global roles --- src/modules/authorizer/ITokenGatedRoleAuthorizer.sol | 7 +++++++ src/modules/authorizer/TokenGatedRoleAuthorizer.sol | 12 +++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/modules/authorizer/ITokenGatedRoleAuthorizer.sol b/src/modules/authorizer/ITokenGatedRoleAuthorizer.sol index 7d5b51f1f..bc2a3713d 100644 --- a/src/modules/authorizer/ITokenGatedRoleAuthorizer.sol +++ b/src/modules/authorizer/ITokenGatedRoleAuthorizer.sol @@ -61,6 +61,13 @@ interface ITokenGatedRoleAuthorizer is IAuthorizer { function grantTokenRoleFromModule(uint8 role, address token, uint threshold) external; + /// @notice Allows a Module to set the Threshold of one of it's roles + /// @param role The token-gated role + /// @param token The token for which the threshold will be set. + /// @param threshold The new minimum balance of the token required to qualify for the role. + function setThresholdFromModule(uint8 role, address token, uint threshold) + external; + /// @notice Sets if a role is token-gated or not. /// @param role The ID of the role to be modified /// @param to The new value to be set. diff --git a/src/modules/authorizer/TokenGatedRoleAuthorizer.sol b/src/modules/authorizer/TokenGatedRoleAuthorizer.sol index 5c08bc24a..981cbf3bb 100644 --- a/src/modules/authorizer/TokenGatedRoleAuthorizer.sol +++ b/src/modules/authorizer/TokenGatedRoleAuthorizer.sol @@ -79,7 +79,13 @@ contract TokenGatedRoleAuthorizer is // If not, check the account against the orchestrator roles } else { roleId = generateRoleId(address(orchestrator()), role); - return hasRole(roleId, who); + //check if token gated: + if (isTokenGated[roleId]) { + //TODO add tests + return hasTokenRole(roleId, who); + } else { + return hasRole(roleId, who); + } } } @@ -110,7 +116,7 @@ contract TokenGatedRoleAuthorizer is public view onlyTokenGated(role) - returns (bool) + returns (bool) { uint numberOfAllowedTokens = getRoleMemberCount(role); @@ -173,7 +179,7 @@ contract TokenGatedRoleAuthorizer is _setThreshold(roleId, token, threshold); } - /// @inheritdoc ITokenGatedRoleAuthorizer + /// @inheritdoc ITokenGatedRoleAuthorizer function setThresholdFromModule(uint8 role, address token, uint threshold) public onlyModule(_msgSender()) From 13f765f3ba636f9ea326bbd8b02df32247e243ca Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Wed, 9 Aug 2023 08:45:16 +0200 Subject: [PATCH 22/32] remove selfManaged logic --- src/modules/authorizer/IAuthorizer.sol | 4 +-- src/modules/authorizer/RoleAuthorizer.sol | 17 +++++------- .../authorizer/TokenGatedRoleAuthorizer.sol | 4 +-- src/modules/logicModule/BountyManager.sol | 1 - test/modules/authorizer/RoleAuthorizer.t.sol | 26 +++++++++---------- .../authorizer/TokenGatedRoleAuthorizer.t.sol | 16 ++---------- test/modules/base/Module.t.sol | 3 --- 7 files changed, 23 insertions(+), 48 deletions(-) diff --git a/src/modules/authorizer/IAuthorizer.sol b/src/modules/authorizer/IAuthorizer.sol index b73795e86..7d66bef94 100644 --- a/src/modules/authorizer/IAuthorizer.sol +++ b/src/modules/authorizer/IAuthorizer.sol @@ -63,8 +63,8 @@ interface IAuthorizer is IAccessControlEnumerableUpgradeable { /// @param target The address to revoke the role from. function revokeRoleFromModule(uint8 role, address target) external; - /// @notice Toggles if a Module self-manages its roles or defaults to the orchestrator's roles. - function toggleModuleSelfManagement() external; + /* /// @notice Toggles if a Module self-manages its roles or defaults to the orchestrator's roles. + function toggleModuleSelfManagement() external; */ /// @notice Transfer the admin rights to a given role. /// @param roleId The role on which to peform the admin transfer diff --git a/src/modules/authorizer/RoleAuthorizer.sol b/src/modules/authorizer/RoleAuthorizer.sol index ce03c7dc0..d44abdba9 100644 --- a/src/modules/authorizer/RoleAuthorizer.sol +++ b/src/modules/authorizer/RoleAuthorizer.sol @@ -45,13 +45,13 @@ contract RoleAuthorizer is _; } - /// @notice Verifies that the calling module has turned on self-management + /* /// @notice Verifies that the calling module has turned on self-management modifier onlySelfManaged() { if (!selfManagedModules[_msgSender()]) { revert Module__RoleAuthorizer__ModuleNotSelfManaged(); } _; - } + } */ /// @notice Verifies that the owner being removed is not the last one modifier notLastOwner(bytes32 role) { @@ -182,7 +182,7 @@ contract RoleAuthorizer is // State-altering functions - /// @inheritdoc IAuthorizer + /* /// @inheritdoc IAuthorizer function toggleModuleSelfManagement() external onlyModule(_msgSender()) { if (selfManagedModules[_msgSender()]) { selfManagedModules[_msgSender()] = false; @@ -191,14 +191,14 @@ contract RoleAuthorizer is selfManagedModules[_msgSender()] = true; emit setRoleSelfManagement(_msgSender(), true); } - } + } */ /// @inheritdoc IAuthorizer function grantRoleFromModule(uint8 role, address target) external onlyModule(_msgSender()) - onlySelfManaged { + selfManagedModules[_msgSender()] = true; // placeholder for in between removing uint8 role system bytes32 roleId = generateRoleId(_msgSender(), role); _grantRole(roleId, target); } @@ -207,7 +207,6 @@ contract RoleAuthorizer is function revokeRoleFromModule(uint8 role, address target) external onlyModule(_msgSender()) - onlySelfManaged { bytes32 roleId = generateRoleId(_msgSender(), role); _revokeRole(roleId, target); @@ -222,11 +221,7 @@ contract RoleAuthorizer is } /// @inheritdoc IAuthorizer - function burnAdminRole(uint8 role) - external - onlyModule(_msgSender()) - onlySelfManaged - { + function burnAdminRole(uint8 role) external onlyModule(_msgSender()) { bytes32 roleId = generateRoleId(_msgSender(), role); _setRoleAdmin(roleId, BURN_ADMIN_ROLE); } diff --git a/src/modules/authorizer/TokenGatedRoleAuthorizer.sol b/src/modules/authorizer/TokenGatedRoleAuthorizer.sol index 981cbf3bb..7e75ecfc0 100644 --- a/src/modules/authorizer/TokenGatedRoleAuthorizer.sol +++ b/src/modules/authorizer/TokenGatedRoleAuthorizer.sol @@ -159,7 +159,6 @@ contract TokenGatedRoleAuthorizer is function makeRoleTokenGatedFromModule(uint8 role) public onlyModule(_msgSender()) - onlySelfManaged onlyEmptyRole(generateRoleId(_msgSender(), role)) { bytes32 roleId = generateRoleId(_msgSender(), role); @@ -172,8 +171,8 @@ contract TokenGatedRoleAuthorizer is function grantTokenRoleFromModule(uint8 role, address token, uint threshold) external onlyModule(_msgSender()) - onlySelfManaged { + selfManagedModules[_msgSender()] = true; // placeholder for in between removing uint8 role system bytes32 roleId = generateRoleId(_msgSender(), role); _grantRole(roleId, token); _setThreshold(roleId, token, threshold); @@ -183,7 +182,6 @@ contract TokenGatedRoleAuthorizer is function setThresholdFromModule(uint8 role, address token, uint threshold) public onlyModule(_msgSender()) - onlySelfManaged { //TODO write tests bytes32 roleId = generateRoleId(_msgSender(), role); diff --git a/src/modules/logicModule/BountyManager.sol b/src/modules/logicModule/BountyManager.sol index 3dce52afa..f572d44a9 100644 --- a/src/modules/logicModule/BountyManager.sol +++ b/src/modules/logicModule/BountyManager.sol @@ -192,7 +192,6 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { { //Note: due to the authorizer still not being set during initialization, // this function has to be called after. - orchestrator().authorizer().toggleModuleSelfManagement(); } //-------------------------------------------------------------------------- diff --git a/test/modules/authorizer/RoleAuthorizer.t.sol b/test/modules/authorizer/RoleAuthorizer.t.sol index 846cc1567..c1ed36d51 100644 --- a/test/modules/authorizer/RoleAuthorizer.t.sol +++ b/test/modules/authorizer/RoleAuthorizer.t.sol @@ -450,7 +450,7 @@ contract RoleAuthorizerTest is Test { ); } - function testGrantRoleFromModuleFailsIfModuleNotSelfManaged() public { + /* function testGrantRoleFromModuleFailsIfModuleNotSelfManaged() public { address newModule = _setupMockSelfManagedModule(); vm.startPrank(newModule); @@ -474,7 +474,7 @@ contract RoleAuthorizerTest is Test { ), false ); - } + } */ function testGrantRoleFromModuleIdempotence() public { address newModule = _setupMockSelfManagedModule(); @@ -576,7 +576,7 @@ contract RoleAuthorizerTest is Test { ); } - function testRevokeRoleFromModuleFailsIfModuleNotSelfManaged() public { + /* function testRevokeRoleFromModuleFailsIfModuleNotSelfManaged() public { address newModule = _setupMockSelfManagedModule(); vm.startPrank(newModule); @@ -601,7 +601,7 @@ contract RoleAuthorizerTest is Test { false ); } - + */ function testRevokeRoleFromModuleIdempotence() public { address newModule = _setupMockSelfManagedModule(); @@ -791,7 +791,7 @@ contract RoleAuthorizerTest is Test { vm.stopPrank(); } - // Test toggleModuleSelfManagement + /* // Test toggleModuleSelfManagement // Test selfManagement gets recognized function testtoggleModuleSelfManagement() public { // we set up a mock module and buffer the role with burned admin @@ -805,9 +805,9 @@ contract RoleAuthorizerTest is Test { //Now it isn't self-managed anymore assertFalse(_authorizer.selfManagedModules(newModule)); - } + } */ // Test module is using own roles when selfmanaged - + /* function testModuleOnlyUsesOwnRolesWhenSelfManaged() public { // First, we set up a modul and authorize BOB address newModule = _setupMockSelfManagedModule(); @@ -822,9 +822,9 @@ contract RoleAuthorizerTest is Test { assertFalse(_authorizer.isAuthorized(uint8(0), ALBA)); vm.stopPrank(); - } + } */ - function testModuleOnlyUsesOrchestratorRolesWhenNotSelfManaged() public { + /* function testModuleOnlyUsesOrchestratorRolesWhenNotSelfManaged() public { // First, we set up a module and authorize BOB address newModule = _setupMockSelfManagedModule(); @@ -844,7 +844,7 @@ contract RoleAuthorizerTest is Test { assertTrue(_authorizer.isAuthorized(uint8(0), ALBA)); vm.stopPrank(); - } + } */ // Test module can correctly return to managed mode function testModuleReturnToManagedMode() public { @@ -891,7 +891,7 @@ contract RoleAuthorizerTest is Test { vm.stopPrank(); } - // -> Modules with burnt admin CAN return to managed state + /* // -> Modules with burnt admin CAN return to managed state function testBurnedModuleCorrectlyReturnToManagedState() public { // Same as testModuleOnlyUsesOrchestratorRolesWhenNotSelfManaged but with ROLE_1 @@ -914,7 +914,7 @@ contract RoleAuthorizerTest is Test { assertTrue(_authorizer.isAuthorized(uint8(0), ALBA)); vm.stopPrank(); - } + } */ // ========================================================================= // Test Helper Functions @@ -931,8 +931,6 @@ contract RoleAuthorizerTest is Test { _orchestrator.addModule(address(mockModule)); vm.startPrank(address(mockModule)); - _authorizer.toggleModuleSelfManagement(); - _authorizer.burnAdminRole(uint8(ModuleRoles.ROLE_1)); vm.stopPrank(); diff --git a/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol b/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol index 29cdc0086..5962db877 100644 --- a/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol +++ b/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol @@ -152,10 +152,6 @@ contract TokenGatedRoleAuthorizerTest is Test { //Then, a ERC721 for BOB roleNft.mint(BOB); - - // By default, the mockModule will have self-management ON - vm.prank(address(mockModule)); - _authorizer.toggleModuleSelfManagement(); } //------------------------------------------------- @@ -170,9 +166,7 @@ contract TokenGatedRoleAuthorizerTest is Test { ) internal returns (bytes32) { bytes32 roleId = _authorizer.generateRoleId(module, role); vm.startPrank(module); - if (!_authorizer.selfManagedModules(module)) { - _authorizer.toggleModuleSelfManagement(); - } + _authorizer.makeRoleTokenGatedFromModule(role); _authorizer.grantTokenRoleFromModule(role, address(token), threshold); vm.stopPrank(); @@ -186,9 +180,7 @@ contract TokenGatedRoleAuthorizerTest is Test { { bytes32 roleId = _authorizer.generateRoleId(module, role); vm.startPrank(module); - if (!_authorizer.selfManagedModules(module)) { - _authorizer.toggleModuleSelfManagement(); - } + _authorizer.makeRoleTokenGatedFromModule(role); _authorizer.grantTokenRoleFromModule(role, address(nft), 1); vm.stopPrank(); @@ -229,10 +221,6 @@ contract TokenGatedRoleAuthorizerTest is Test { //we set and unset on an empty role - // first we turn on self-management - vm.prank(address(mockModule)); - _authorizer.toggleModuleSelfManagement(); - bytes32 roleId = _authorizer.generateRoleId(address(mockModule), uint8(0)); diff --git a/test/modules/base/Module.t.sol b/test/modules/base/Module.t.sol index b7250367b..0bdf68655 100644 --- a/test/modules/base/Module.t.sol +++ b/test/modules/base/Module.t.sol @@ -131,8 +131,6 @@ contract baseModuleTest is ModuleTest { vm.startPrank(address(this)); - _authorizer.toggleModuleSelfManagement(); - module.grantModuleRole(role, addr); bytes32 roleId = _authorizer.generateRoleId(address(module), role); @@ -147,7 +145,6 @@ contract baseModuleTest is ModuleTest { vm.assume(addr != address(0)); vm.startPrank(address(this)); - _authorizer.toggleModuleSelfManagement(); module.grantModuleRole(role, addr); module.revokeModuleRole(role, addr); From 3877554e41fd23286ca0ba01072a9a98bf25a545 Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Thu, 10 Aug 2023 07:43:07 +0200 Subject: [PATCH 23/32] first steps to change role format --- src/modules/authorizer/IAuthorizer.sol | 11 +++++++++++ src/modules/authorizer/RoleAuthorizer.sol | 24 +++++++++++++++++------ src/modules/base/Module.sol | 4 ++-- src/modules/logicModule/BountyManager.sol | 10 +++++----- 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/src/modules/authorizer/IAuthorizer.sol b/src/modules/authorizer/IAuthorizer.sol index 7d66bef94..81c7e27e7 100644 --- a/src/modules/authorizer/IAuthorizer.sol +++ b/src/modules/authorizer/IAuthorizer.sol @@ -43,6 +43,17 @@ interface IAuthorizer is IAccessControlEnumerableUpgradeable { view returns (bool); + /// @notice Asks whether an address holds the required module role to execute + /// the current transaction. + /// @param role The identifier of the role we want to check + /// @param who The address on which to perform the check. + /// @dev It will use the calling address to generate the role ID. Therefore, for checking on anything other than itself, hasRole() should be used + function hasModuleRole(bytes32 role, address who) + external + view + virtual + returns (bool); + //-------------------------------------------------------------------------- // Functions diff --git a/src/modules/authorizer/RoleAuthorizer.sol b/src/modules/authorizer/RoleAuthorizer.sol index d44abdba9..48cc63928 100644 --- a/src/modules/authorizer/RoleAuthorizer.sol +++ b/src/modules/authorizer/RoleAuthorizer.sol @@ -16,20 +16,20 @@ contract RoleAuthorizer is //-------------------------------------------------------------------------- // Storage - // Core roles for a orchestrator. They correspond to uint8(0) and uint(1) + /* // Core roles for a orchestrator. They correspond to uint8(0) and uint(1) // NOTE that orchestrator owner can register more global roles using numbers from 2 onward. They'l need to go through the DEFAULT_ADMIN_ROLE for this. enum CoreRoles { OWNER, // Full Access to Protected Functions MANAGER // Partial Access to Protected Functions } - + */ // Stores the if a module wants to use it's own roles // If false it uses the orchestrator's core roles. mapping(address => bool) public selfManagedModules; // Stored for easy public reference. Other Modules can assume the following roles to exist - bytes32 public ORCHESTRATOR_OWNER_ROLE; - bytes32 public ORCHESTRATOR_MANAGER_ROLE; + bytes32 public ORCHESTRATOR_OWNER_ROLE = "0x01"; + bytes32 public ORCHESTRATOR_MANAGER_ROLE = "0x02"; bytes32 public constant BURN_ADMIN_ROLE = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; @@ -95,10 +95,10 @@ contract RoleAuthorizer is // Modules can opt out of this on a per-role basis by setting the admin role to "BURN_ADMIN_ROLE". // Store RoleIDs for the Orchestrator roles: - ORCHESTRATOR_OWNER_ROLE = + /* ORCHESTRATOR_OWNER_ROLE = generateRoleId(address(orchestrator()), uint8(CoreRoles.OWNER)); ORCHESTRATOR_MANAGER_ROLE = - generateRoleId(address(orchestrator()), uint8(CoreRoles.MANAGER)); + generateRoleId(address(orchestrator()), uint8(CoreRoles.MANAGER)); */ //We preliminarily grant admin role to the caller _grantRole(ORCHESTRATOR_OWNER_ROLE, _msgSender()); @@ -170,6 +170,18 @@ contract RoleAuthorizer is return hasRole(roleId, who); } + /// @inheritdoc IAuthorizer + function hasModuleRole(bytes32 role, address who) + external + view + virtual + returns (bool) + { + //Note: since it uses msgSenderto generate ID, this should only be used by modules. Users should call hasRole() + bytes32 roleId = generateRoleId(_msgSender(), role); + return hasRole(roleId, who); + } + /// @inheritdoc IAuthorizer function generateRoleId(address module, uint8 role) public diff --git a/src/modules/base/Module.sol b/src/modules/base/Module.sol index ff314dfde..e0f56d6e7 100644 --- a/src/modules/base/Module.sol +++ b/src/modules/base/Module.sol @@ -90,9 +90,9 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { } /// @notice Modifier to guarantee function is only callable by addresses that hold a specific module-assigned role. - modifier onlyModuleRole(uint8 roleId) { + modifier onlyModuleRole(bytes32 roleId) { if ( - !__Module_orchestrator.authorizer().isAuthorized( + !__Module_orchestrator.authorizer().hasModuleRole( roleId, _msgSender() ) ) { diff --git a/src/modules/logicModule/BountyManager.sol b/src/modules/logicModule/BountyManager.sol index f572d44a9..754d399ec 100644 --- a/src/modules/logicModule/BountyManager.sol +++ b/src/modules/logicModule/BountyManager.sol @@ -256,7 +256,7 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { bytes calldata details ) external - onlyModuleRole(uint8(Roles.BountyAdmin)) + onlyModuleRole(bytes32(Roles.BountyAdmin)) validPayoutAmounts(minimumPayoutAmount, maximumPayoutAmount) returns (uint id) { @@ -282,7 +282,7 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { /// @inheritdoc IBountyManager function updateBounty(uint bountyId, bytes calldata details) external - onlyModuleRole(uint8(Roles.BountyAdmin)) + onlyModuleRole(bytes32(Roles.BountyAdmin)) validBountyId(bountyId) { _bountyRegistry[bountyId].details = details; @@ -293,7 +293,7 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { /// @inheritdoc IBountyManager function lockBounty(uint bountyId) external - onlyModuleRole(uint8(Roles.BountyAdmin)) + onlyModuleRole(bytes32(Roles.BountyAdmin)) validBountyId(bountyId) notClaimed(bountyId) { @@ -309,7 +309,7 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { bytes calldata details ) external - onlyModuleRole(uint8(Roles.ClaimAdmin)) + onlyModuleRole(bytes32(Roles.ClaimAdmin)) validBountyId(bountyId) notClaimed(bountyId) returns (uint id) @@ -396,7 +396,7 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { /// @inheritdoc IBountyManager function verifyClaim(uint claimId, uint bountyId) external - onlyModuleRole(uint8(Roles.VerifyAdmin)) + onlyModuleRole(bytes32(Roles.VerifyAdmin)) validClaimId(claimId) validBountyId(bountyId) claimBelongingToBounty(claimId, bountyId) From 313e5a0c9f00b379147c00329ea356f1313d4e3e Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Mon, 14 Aug 2023 10:12:12 +0200 Subject: [PATCH 24/32] partial fixes in tests --- lcov.info | 8 +- src/modules/authorizer/IAuthorizer.sol | 21 ++- .../authorizer/ITokenGatedRoleAuthorizer.sol | 11 +- src/modules/authorizer/RoleAuthorizer.sol | 21 +-- .../authorizer/TokenGatedRoleAuthorizer.sol | 39 ++++- src/modules/base/IModule.sol | 4 +- src/modules/base/Module.sol | 8 +- src/modules/logicModule/BountyManager.sol | 14 +- src/orchestrator/IOrchestrator.sol | 2 +- src/orchestrator/Orchestrator.sol | 23 +-- test/e2e/BountyManagerLifecycle.t.sol | 6 +- test/e2e/SingleVoteGovernorLifecycle.sol | 4 +- test/modules/authorizer/RoleAuthorizer.t.sol | 143 +++++++----------- .../authorizer/SingleVoteGovernor.t.sol | 8 +- .../authorizer/TokenGatedRoleAuthorizer.t.sol | 101 ++++--------- test/modules/base/Module.t.sol | 19 +-- test/orchestrator/Orchestrator.t.sol | 7 +- test/utils/mocks/modules/AuthorizerMock.sol | 36 +++-- 18 files changed, 226 insertions(+), 249 deletions(-) diff --git a/lcov.info b/lcov.info index 4b6d6ae80..8de138558 100644 --- a/lcov.info +++ b/lcov.info @@ -562,8 +562,8 @@ DA:213,7 FN:217,RoleAuthorizer.transferAdminRole FNDA:4,RoleAuthorizer.transferAdminRole DA:221,2 -FN:225,RoleAuthorizer.burnAdminRole -FNDA:38,RoleAuthorizer.burnAdminRole +FN:225,RoleAuthorizer.burnAdminFromModuleRole +FNDA:38,RoleAuthorizer.burnAdminFromModuleRole DA:230,38 DA:231,38 FN:235,RoleAuthorizer.grantGlobalRole @@ -2803,8 +2803,8 @@ FN:94,AuthorizerMock.toggleModuleSelfManagement FNDA:514,AuthorizerMock.toggleModuleSelfManagement FN:96,AuthorizerMock.transferAdminRole FNDA:0,AuthorizerMock.transferAdminRole -FN:98,AuthorizerMock.burnAdminRole -FNDA:0,AuthorizerMock.burnAdminRole +FN:98,AuthorizerMock.burnAdminFromModuleRole +FNDA:0,AuthorizerMock.burnAdminFromModuleRole FN:102,AuthorizerMock.getRoleAdmin FNDA:0,AuthorizerMock.getRoleAdmin DA:103,0 diff --git a/src/modules/authorizer/IAuthorizer.sol b/src/modules/authorizer/IAuthorizer.sol index 81c7e27e7..9f9ba7e52 100644 --- a/src/modules/authorizer/IAuthorizer.sol +++ b/src/modules/authorizer/IAuthorizer.sol @@ -28,7 +28,7 @@ interface IAuthorizer is IAccessControlEnumerableUpgradeable { //-------------------------------------------------------------------------- // Overloaded and overriden functions - /// @notice Returns if an address has the Orchestrator Owner Role + /* /// @notice Returns if an address has the Orchestrator Owner Role /// @param who The adress to be checked. function isAuthorized(address who) external view returns (bool); @@ -41,7 +41,7 @@ interface IAuthorizer is IAccessControlEnumerableUpgradeable { function isAuthorized(uint8 role, address who) external view - returns (bool); + returns (bool); */ /// @notice Asks whether an address holds the required module role to execute /// the current transaction. @@ -51,7 +51,6 @@ interface IAuthorizer is IAccessControlEnumerableUpgradeable { function hasModuleRole(bytes32 role, address who) external view - virtual returns (bool); //-------------------------------------------------------------------------- @@ -60,19 +59,19 @@ interface IAuthorizer is IAccessControlEnumerableUpgradeable { /// @notice Helper function to generate a bytes32 role hash for a module role /// @param module The address of the module to generate the hash for /// @param role The ID number of the role to generate the hash for - function generateRoleId(address module, uint8 role) + function generateRoleId(address module, bytes32 role) external returns (bytes32); /// @notice Used by a Module to grant a role to a user. /// @param role The identifier of the role to grant /// @param target The address to which to grant the role. - function grantRoleFromModule(uint8 role, address target) external; + function grantRoleFromModule(bytes32 role, address target) external; /// @notice Used by a Module to revoke a role from a user. /// @param role The identifier of the role to revoke /// @param target The address to revoke the role from. - function revokeRoleFromModule(uint8 role, address target) external; + function revokeRoleFromModule(bytes32 role, address target) external; /* /// @notice Toggles if a Module self-manages its roles or defaults to the orchestrator's roles. function toggleModuleSelfManagement() external; */ @@ -85,25 +84,25 @@ interface IAuthorizer is IAccessControlEnumerableUpgradeable { /// @notice Irreversibly burns the admin of a given role. /// @param role The role to remove admin access from /// @dev The module itself can still grant and revoke it's own roles. This only burns third-party access to the role. - function burnAdminRole(uint8 role) external; + function burnAdminFromModuleRole(bytes32 role) external; /// @notice Grants a global role to a target /// @param role The role to grant /// @param target The address to grant the role to /// @dev Only the addresses with the Owner role should be able to call this function - function grantGlobalRole(uint8 role, address target) external; + function grantGlobalRole(bytes32 role, address target) external; /// @notice Revokes a global role from a target /// @param role The role to grant /// @param target The address to grant the role to /// @dev Only the addresses with the Owner role should be able to call this function - function revokeGlobalRole(uint8 role, address target) external; + function revokeGlobalRole(bytes32 role, address target) external; /// @notice Returns the role ID of the owner role /// @return The role ID - function getOwnerRole() external returns (bytes32); + function getOwnerRole() external view returns (bytes32); /// @notice Returns the role ID of the manager role /// @return The role ID - function getManagerRole() external returns (bytes32); + function getManagerRole() external view returns (bytes32); } diff --git a/src/modules/authorizer/ITokenGatedRoleAuthorizer.sol b/src/modules/authorizer/ITokenGatedRoleAuthorizer.sol index bc2a3713d..4f61177cb 100644 --- a/src/modules/authorizer/ITokenGatedRoleAuthorizer.sol +++ b/src/modules/authorizer/ITokenGatedRoleAuthorizer.sol @@ -52,20 +52,23 @@ interface ITokenGatedRoleAuthorizer is IAuthorizer { /// @param role The role to be made token-gated /// @dev This function is only callable by an active Module for itself. Admin should use setTokenGated(). /// @dev Calling this function does not specify WHICH token to use for gating. That has to be done with 'grantTokenFromModule()' - function makeRoleTokenGatedFromModule(uint8 role) external; + function makeRoleTokenGatedFromModule(bytes32 role) external; /// @notice One-step setup for Modules to create a token-gated role and set its threshold. /// @param role The role to be made token-gated /// @param token The token for which the threshold will be set. /// @param threshold The minimum balance of the token required to qualify for the role. - function grantTokenRoleFromModule(uint8 role, address token, uint threshold) - external; + function grantTokenRoleFromModule( + bytes32 role, + address token, + uint threshold + ) external; /// @notice Allows a Module to set the Threshold of one of it's roles /// @param role The token-gated role /// @param token The token for which the threshold will be set. /// @param threshold The new minimum balance of the token required to qualify for the role. - function setThresholdFromModule(uint8 role, address token, uint threshold) + function setThresholdFromModule(bytes32 role, address token, uint threshold) external; /// @notice Sets if a role is token-gated or not. diff --git a/src/modules/authorizer/RoleAuthorizer.sol b/src/modules/authorizer/RoleAuthorizer.sol index 48cc63928..5002c324f 100644 --- a/src/modules/authorizer/RoleAuthorizer.sol +++ b/src/modules/authorizer/RoleAuthorizer.sol @@ -143,7 +143,7 @@ contract RoleAuthorizer is // Public functions // View functions - +/* /// @inheritdoc IAuthorizer /// @dev Implements the function of the IAuthorizer interface by defauling to check if the caller holds the OWNER role. function isAuthorized(address who) external view returns (bool) { @@ -152,7 +152,7 @@ contract RoleAuthorizer is } /// @inheritdoc IAuthorizer - function isAuthorized(uint8 role, address who) + function isAuthorized(bytes32 role, address who) external view virtual @@ -169,7 +169,7 @@ contract RoleAuthorizer is } return hasRole(roleId, who); } - + */ /// @inheritdoc IAuthorizer function hasModuleRole(bytes32 role, address who) external @@ -183,7 +183,7 @@ contract RoleAuthorizer is } /// @inheritdoc IAuthorizer - function generateRoleId(address module, uint8 role) + function generateRoleId(address module, bytes32 role) public pure returns (bytes32) @@ -206,7 +206,7 @@ contract RoleAuthorizer is } */ /// @inheritdoc IAuthorizer - function grantRoleFromModule(uint8 role, address target) + function grantRoleFromModule(bytes32 role, address target) external onlyModule(_msgSender()) { @@ -216,7 +216,7 @@ contract RoleAuthorizer is } /// @inheritdoc IAuthorizer - function revokeRoleFromModule(uint8 role, address target) + function revokeRoleFromModule(bytes32 role, address target) external onlyModule(_msgSender()) { @@ -233,13 +233,16 @@ contract RoleAuthorizer is } /// @inheritdoc IAuthorizer - function burnAdminRole(uint8 role) external onlyModule(_msgSender()) { + function burnAdminFromModuleRole(bytes32 role) + external + onlyModule(_msgSender()) + { bytes32 roleId = generateRoleId(_msgSender(), role); _setRoleAdmin(roleId, BURN_ADMIN_ROLE); } /// @inheritdoc IAuthorizer - function grantGlobalRole(uint8 role, address target) + function grantGlobalRole(bytes32 role, address target) external onlyRole(ORCHESTRATOR_OWNER_ROLE) { @@ -248,7 +251,7 @@ contract RoleAuthorizer is } /// @inheritdoc IAuthorizer - function revokeGlobalRole(uint8 role, address target) + function revokeGlobalRole(bytes32 role, address target) external onlyRole(ORCHESTRATOR_OWNER_ROLE) { diff --git a/src/modules/authorizer/TokenGatedRoleAuthorizer.sol b/src/modules/authorizer/TokenGatedRoleAuthorizer.sol index 7e75ecfc0..32c135bf7 100644 --- a/src/modules/authorizer/TokenGatedRoleAuthorizer.sol +++ b/src/modules/authorizer/TokenGatedRoleAuthorizer.sol @@ -3,7 +3,15 @@ pragma solidity 0.8.19; // External Libraries import {ITokenGatedRoleAuthorizer} from "./ITokenGatedRoleAuthorizer.sol"; -import {IAuthorizer, RoleAuthorizer} from "./RoleAuthorizer.sol"; +import { + IAuthorizer, + RoleAuthorizer, + AccessControlEnumerableUpgradeable +} from "./RoleAuthorizer.sol"; +import { + AccessControlUpgradeable, + IAccessControlUpgradeable +} from "@oz-up/access/AccessControlUpgradeable.sol"; interface TokenInterface { function balanceOf(address _owner) external view returns (uint balance); @@ -57,7 +65,7 @@ contract TokenGatedRoleAuthorizer is //-------------------------------------------------------------------------- // Overloaded and overriden functions - /// @inheritdoc RoleAuthorizer + /* /// @inheritdoc RoleAuthorizer /// @dev We add a check to call a different function if the role is token-gated. function isAuthorized(uint8 role, address who) public @@ -87,6 +95,20 @@ contract TokenGatedRoleAuthorizer is return hasRole(roleId, who); } } + } */ + + function hasRole(bytes32 roleId, address account) + public + view + virtual + override(AccessControlUpgradeable, IAccessControlUpgradeable) + returns (bool) + { + if (isTokenGated[roleId]) { + return hasTokenRole(roleId, account); + } else { + return super.hasRole(roleId, account); + } } /// @notice Grants a role to an address @@ -156,7 +178,7 @@ contract TokenGatedRoleAuthorizer is // State-altering functions /// @inheritdoc ITokenGatedRoleAuthorizer - function makeRoleTokenGatedFromModule(uint8 role) + function makeRoleTokenGatedFromModule(bytes32 role) public onlyModule(_msgSender()) onlyEmptyRole(generateRoleId(_msgSender(), role)) @@ -168,10 +190,11 @@ contract TokenGatedRoleAuthorizer is } /// @inheritdoc ITokenGatedRoleAuthorizer - function grantTokenRoleFromModule(uint8 role, address token, uint threshold) - external - onlyModule(_msgSender()) - { + function grantTokenRoleFromModule( + bytes32 role, + address token, + uint threshold + ) external onlyModule(_msgSender()) { selfManagedModules[_msgSender()] = true; // placeholder for in between removing uint8 role system bytes32 roleId = generateRoleId(_msgSender(), role); _grantRole(roleId, token); @@ -179,7 +202,7 @@ contract TokenGatedRoleAuthorizer is } /// @inheritdoc ITokenGatedRoleAuthorizer - function setThresholdFromModule(uint8 role, address token, uint threshold) + function setThresholdFromModule(bytes32 role, address token, uint threshold) public onlyModule(_msgSender()) { diff --git a/src/modules/base/IModule.sol b/src/modules/base/IModule.sol index 53b3cab47..91bd9af87 100644 --- a/src/modules/base/IModule.sol +++ b/src/modules/base/IModule.sol @@ -84,7 +84,7 @@ interface IModule { /// @return The module's orchestrator. function orchestrator() external view returns (IOrchestrator); - function grantModuleRole(uint8 role, address addr) external; + function grantModuleRole(bytes32 role, address addr) external; - function revokeModuleRole(uint8 role, address addr) external; + function revokeModuleRole(bytes32 role, address addr) external; } diff --git a/src/modules/base/Module.sol b/src/modules/base/Module.sol index e0f56d6e7..95f2c645d 100644 --- a/src/modules/base/Module.sol +++ b/src/modules/base/Module.sol @@ -202,20 +202,20 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { //-------------------------------------------------------------------------- // Role Management - function grantModuleRole(uint8 role, address addr) + function grantModuleRole(bytes32 role, address addr) external onlyOrchestratorOwner { IAuthorizer roleAuthorizer = __Module_orchestrator.authorizer(); - roleAuthorizer.grantRoleFromModule(uint8(role), addr); + roleAuthorizer.grantRoleFromModule(role, addr); } - function revokeModuleRole(uint8 role, address addr) + function revokeModuleRole(bytes32 role, address addr) external onlyOrchestratorOwner { IAuthorizer roleAuthorizer = __Module_orchestrator.authorizer(); - roleAuthorizer.revokeRoleFromModule(uint8(role), addr); + roleAuthorizer.revokeRoleFromModule(role, addr); } //-------------------------------------------------------------------------- diff --git a/src/modules/logicModule/BountyManager.sol b/src/modules/logicModule/BountyManager.sol index 754d399ec..ef0e0c5ad 100644 --- a/src/modules/logicModule/BountyManager.sol +++ b/src/modules/logicModule/BountyManager.sol @@ -150,6 +150,10 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { /// @dev Marks the beginning of the list. uint internal constant _SENTINEL = type(uint).max; + bytes32 public constant BOUNTY_ADMIN_ROLE = "BOUNTY_ADMIN"; + bytes32 public constant CLAIM_ADMIN_ROLE = "CLAIM_ADMIN"; + bytes32 public constant VERIFY_ADMIN_ROLE = "VERIFY_ADMIN"; + //-------------------------------------------------------------------------- // Storage @@ -256,7 +260,7 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { bytes calldata details ) external - onlyModuleRole(bytes32(Roles.BountyAdmin)) + onlyModuleRole(BOUNTY_ADMIN_ROLE) validPayoutAmounts(minimumPayoutAmount, maximumPayoutAmount) returns (uint id) { @@ -282,7 +286,7 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { /// @inheritdoc IBountyManager function updateBounty(uint bountyId, bytes calldata details) external - onlyModuleRole(bytes32(Roles.BountyAdmin)) + onlyModuleRole(BOUNTY_ADMIN_ROLE) validBountyId(bountyId) { _bountyRegistry[bountyId].details = details; @@ -293,7 +297,7 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { /// @inheritdoc IBountyManager function lockBounty(uint bountyId) external - onlyModuleRole(bytes32(Roles.BountyAdmin)) + onlyModuleRole(BOUNTY_ADMIN_ROLE) validBountyId(bountyId) notClaimed(bountyId) { @@ -309,7 +313,7 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { bytes calldata details ) external - onlyModuleRole(bytes32(Roles.ClaimAdmin)) + onlyModuleRole(CLAIM_ADMIN_ROLE) validBountyId(bountyId) notClaimed(bountyId) returns (uint id) @@ -396,7 +400,7 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { /// @inheritdoc IBountyManager function verifyClaim(uint claimId, uint bountyId) external - onlyModuleRole(bytes32(Roles.VerifyAdmin)) + onlyModuleRole(VERIFY_ADMIN_ROLE) validClaimId(claimId) validBountyId(bountyId) claimBelongingToBounty(claimId, bountyId) diff --git a/src/orchestrator/IOrchestrator.sol b/src/orchestrator/IOrchestrator.sol index d8edab8a2..aca4ca0aa 100644 --- a/src/orchestrator/IOrchestrator.sol +++ b/src/orchestrator/IOrchestrator.sol @@ -16,7 +16,7 @@ interface IOrchestrator is IModuleManager { // Errors /// @notice Function is only callable by authorized caller. - error Orchestrator__CallerNotAuthorized(); + error Orchestrator__CallerNotAuthorized(bytes32 role, address caller); /// @notice Execution of transaction failed. error Orchestrator__ExecuteTxFailed(); diff --git a/src/orchestrator/Orchestrator.sol b/src/orchestrator/Orchestrator.sol index ac2e174f5..a91675080 100644 --- a/src/orchestrator/Orchestrator.sol +++ b/src/orchestrator/Orchestrator.sol @@ -47,8 +47,10 @@ contract Orchestrator is IOrchestrator, ModuleManager { /// @notice Modifier to guarantee function is only callable by authorized /// address. modifier onlyOrchestratorOwner() { - if (!authorizer.isAuthorized(_msgSender())) { - revert Orchestrator__CallerNotAuthorized(); + bytes32 ownerRole = authorizer.getOwnerRole(); + + if (!authorizer.hasRole(ownerRole, _msgSender())) { + revert Orchestrator__CallerNotAuthorized(ownerRole, _msgSender()); } _; } @@ -59,11 +61,13 @@ contract Orchestrator is IOrchestrator, ModuleManager { /// @notice Modifier to guarantee function is only callable by authorized /// address or manager. modifier onlyOrchestratorOwnerOrManager() { - if ( - !authorizer.isAuthorized(_msgSender()) - && !authorizer.hasRole(authorizer.getManagerRole(), _msgSender()) - ) { - revert Orchestrator__CallerNotAuthorized(); + bytes32 ownerRole = authorizer.getOwnerRole(); + bytes32 managerRole = authorizer.getManagerRole(); + + if (!authorizer.hasRole(managerRole, _msgSender())) { + revert Orchestrator__CallerNotAuthorized(managerRole, _msgSender()); + } else if (!authorizer.hasRole(ownerRole, _msgSender())) { + revert Orchestrator__CallerNotAuthorized(ownerRole, _msgSender()); } _; } @@ -188,8 +192,7 @@ contract Orchestrator is IOrchestrator, ModuleManager { { IAuthorizer authorizerModule = IAuthorizer(authModule); - try authorizerModule.isAuthorized(address(uint160(1234))) returns (bool) - { + try authorizerModule.getOwnerRole() returns (bytes32) { return true; } catch { return false; @@ -269,7 +272,7 @@ contract Orchestrator is IOrchestrator, ModuleManager { override(ModuleManager) returns (bool) { - return authorizer.isAuthorized(who); + return authorizer.hasRole(authorizer.getOwnerRole(), who); } //-------------------------------------------------------------------------- diff --git a/test/e2e/BountyManagerLifecycle.t.sol b/test/e2e/BountyManagerLifecycle.t.sol index ee6e65608..558273fda 100644 --- a/test/e2e/BountyManagerLifecycle.t.sol +++ b/test/e2e/BountyManagerLifecycle.t.sol @@ -81,7 +81,7 @@ contract BountyManagerLifecycle is E2eTest { // we authorize the deployer of the orchestrator as the bounty admin bountyManager.grantModuleRole( - uint8(IBountyManager.Roles.BountyAdmin), address(this) + bountyManager.BOUNTY_ADMIN_ROLE(), address(this) ); // Funders deposit funds @@ -125,7 +125,7 @@ contract BountyManagerLifecycle is E2eTest { //auth.setIsAuthorized(address(0xA11CE), true); bountyManager.grantModuleRole( - uint8(IBountyManager.Roles.ClaimAdmin), address(0xA11CE) + bountyManager.CLAIM_ADMIN_ROLE(), address(0xA11CE) ); IBountyManager.Contributor[] memory contribs = @@ -144,7 +144,7 @@ contract BountyManagerLifecycle is E2eTest { //auth.setIsAuthorized(verifier1, true); bountyManager.grantModuleRole( - uint8(IBountyManager.Roles.VerifyAdmin), verifier1 + bountyManager.VERIFY_ADMIN_ROLE(), verifier1 ); vm.prank(verifier1); diff --git a/test/e2e/SingleVoteGovernorLifecycle.sol b/test/e2e/SingleVoteGovernorLifecycle.sol index 98a313ff5..a53c87890 100644 --- a/test/e2e/SingleVoteGovernorLifecycle.sol +++ b/test/e2e/SingleVoteGovernorLifecycle.sol @@ -99,7 +99,9 @@ contract SingleVoteGovernorLifecycle is E2eTest { authorizer.grantRole(ownerRole, address(singleVoteGovernor)); // we authorize governance to create bounties - bountyManager.grantModuleRole(uint8(0), address(singleVoteGovernor)); + bountyManager.grantModuleRole( + bountyManager.BOUNTY_ADMIN_ROLE(), address(singleVoteGovernor) + ); authorizer.renounceRole(ownerRole, address(this)); diff --git a/test/modules/authorizer/RoleAuthorizer.t.sol b/test/modules/authorizer/RoleAuthorizer.t.sol index c1ed36d51..ccdff6271 100644 --- a/test/modules/authorizer/RoleAuthorizer.t.sol +++ b/test/modules/authorizer/RoleAuthorizer.t.sol @@ -36,10 +36,8 @@ contract RoleAuthorizerTest is Test { address ALBA = address(0xa1ba); //default authorized person address BOB = address(0xb0b); // example person to add - enum ModuleRoles { - ROLE_0, - ROLE_1 - } + bytes32 immutable ROLE_0 = "ROLE_0"; + bytes32 immutable ROLE_1 = "ROLE_1"; // Orchestrator Constants uint internal constant _ORCHESTRATOR_ID = 1; @@ -107,9 +105,9 @@ contract RoleAuthorizerTest is Test { assertEq(address(testAuthorizer.orchestrator()), address(_orchestrator)); - assertEq(testAuthorizer.isAuthorized(0, initialAuth), true); + assertEq(testAuthorizer.hasRole("0x01", initialAuth), true); - assertEq(testAuthorizer.isAuthorized(0, address(this)), false); + assertEq(testAuthorizer.hasRole("0x01", address(this)), false); assertEq( testAuthorizer.getRoleMemberCount(testAuthorizer.getOwnerRole()), 1 ); @@ -132,7 +130,7 @@ contract RoleAuthorizerTest is Test { assertEq(address(testAuthorizer.orchestrator()), address(_orchestrator)); - assertEq(testAuthorizer.isAuthorized(0, address(this)), true); + assertEq(testAuthorizer.hasRole("0x01", address(this)), true); assertEq( testAuthorizer.getRoleMemberCount(testAuthorizer.getOwnerRole()), 1 ); @@ -152,9 +150,9 @@ contract RoleAuthorizerTest is Test { _METADATA, abi.encode(initialAuth, initialManager) ); - assertEq(_authorizer.isAuthorized(0, address(this)), false); + assertEq(_authorizer.hasRole("0x01", address(this)), false); assertEq(address(_authorizer.orchestrator()), address(_orchestrator)); - assertEq(_authorizer.isAuthorized(0, ALBA), true); + assertEq(_authorizer.hasRole("0x01", ALBA), true); assertEq(_authorizer.getRoleMemberCount(_authorizer.getOwnerRole()), 1); } @@ -252,7 +250,7 @@ contract RoleAuthorizerTest is Test { vm.prank(address(ALBA)); _authorizer.revokeRole(ownerRole, ALBA); - assertEq(_authorizer.isAuthorized(ALBA), true); + assertEq(_authorizer.hasRole(ownerRole, ALBA), true); assertEq( _authorizer.getRoleMemberCount(_authorizer.getOwnerRole()), amountAuth @@ -262,8 +260,7 @@ contract RoleAuthorizerTest is Test { function testGrantManagerRole(address[] memory newAuthorized) public { // Here we test adding to a role with OWNER as admin - bytes32 managerRole = - _authorizer.generateRoleId(address(_orchestrator), 1); + bytes32 managerRole = _authorizer.getManagerRole(); uint amountManagers = _authorizer.getRoleMemberCount(managerRole); _validateAuthorizedList(newAuthorized); @@ -287,8 +284,7 @@ contract RoleAuthorizerTest is Test { public { // Here we test adding to a role that has OWNER as admin while not being OWNER - bytes32 managerRole = - _authorizer.generateRoleId(address(_orchestrator), 1); + bytes32 managerRole = _authorizer.getManagerRole(); vm.startPrank(address(ALBA)); _authorizer.grantRole(managerRole, BOB); //Meet your new Manager @@ -317,8 +313,7 @@ contract RoleAuthorizerTest is Test { function testRevokeManagerRole(address[] memory newAuthorized) public { // Here we test adding to a role with OWNER as admin - bytes32 managerRole = - _authorizer.generateRoleId(address(_orchestrator), 1); + bytes32 managerRole = _authorizer.getManagerRole(); uint amountManagers = _authorizer.getRoleMemberCount(managerRole); _validateAuthorizedList(newAuthorized); @@ -359,8 +354,7 @@ contract RoleAuthorizerTest is Test { address[] memory newAuthorized ) public { // Here we test adding to a role that has OWNER as admin while not being OWNER - bytes32 managerRole = - _authorizer.generateRoleId(address(_orchestrator), 1); + bytes32 managerRole = _authorizer.getManagerRole(); vm.startPrank(address(ALBA)); _authorizer.grantRole(managerRole, BOB); //Meet your new Manager @@ -394,19 +388,17 @@ contract RoleAuthorizerTest is Test { assertEq( _authorizer.hasRole( - _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_0)), - ALBA + _authorizer.generateRoleId(newModule, ROLE_0), ALBA ), false ); vm.prank(newModule); - _authorizer.grantRoleFromModule(uint8(ModuleRoles.ROLE_0), ALBA); + _authorizer.grantRoleFromModule(ROLE_0, ALBA); assertEq( _authorizer.hasRole( - _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_0)), - ALBA + _authorizer.generateRoleId(newModule, ROLE_0), ALBA ), true ); @@ -417,11 +409,10 @@ contract RoleAuthorizerTest is Test { vm.prank(address(BOB)); vm.expectRevert(); - _authorizer.grantRoleFromModule(uint8(ModuleRoles.ROLE_0), ALBA); + _authorizer.grantRoleFromModule(ROLE_0, ALBA); assertEq( _authorizer.hasRole( - _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_0)), - ALBA + _authorizer.generateRoleId(newModule, ROLE_0), ALBA ), false ); @@ -440,11 +431,10 @@ contract RoleAuthorizerTest is Test { newModule ) ); - _authorizer.grantRoleFromModule(uint8(ModuleRoles.ROLE_0), ALBA); + _authorizer.grantRoleFromModule(ROLE_0, ALBA); assertEq( _authorizer.hasRole( - _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_0)), - ALBA + _authorizer.generateRoleId(newModule, ROLE_0), ALBA ), false ); @@ -481,17 +471,16 @@ contract RoleAuthorizerTest is Test { vm.startPrank(newModule); - _authorizer.grantRoleFromModule(uint8(ModuleRoles.ROLE_0), ALBA); + _authorizer.grantRoleFromModule(ROLE_0, ALBA); - _authorizer.grantRoleFromModule(uint8(ModuleRoles.ROLE_0), ALBA); + _authorizer.grantRoleFromModule(ROLE_0, ALBA); // No reverts happen vm.stopPrank(); assertEq( _authorizer.hasRole( - _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_0)), - ALBA + _authorizer.generateRoleId(newModule, ROLE_0), ALBA ), true ); @@ -507,32 +496,27 @@ contract RoleAuthorizerTest is Test { assertEq( _authorizer.hasRole( - _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_0)), - BOB + _authorizer.generateRoleId(newModule, ROLE_0), BOB ), false ); vm.prank(newModule); - _authorizer.grantRoleFromModule(uint8(ModuleRoles.ROLE_0), address(BOB)); + _authorizer.grantRoleFromModule(ROLE_0, address(BOB)); assertEq( _authorizer.hasRole( - _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_0)), - BOB + _authorizer.generateRoleId(newModule, ROLE_0), BOB ), true ); vm.prank(newModule); - _authorizer.revokeRoleFromModule( - uint8(ModuleRoles.ROLE_0), address(BOB) - ); + _authorizer.revokeRoleFromModule(ROLE_0, address(BOB)); assertEq( _authorizer.hasRole( - _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_0)), - BOB + _authorizer.generateRoleId(newModule, ROLE_0), BOB ), false ); @@ -543,11 +527,10 @@ contract RoleAuthorizerTest is Test { vm.prank(address(BOB)); vm.expectRevert(); - _authorizer.revokeRoleFromModule(uint8(ModuleRoles.ROLE_0), BOB); + _authorizer.revokeRoleFromModule(ROLE_0, BOB); assertEq( _authorizer.hasRole( - _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_0)), - BOB + _authorizer.generateRoleId(newModule, ROLE_0), BOB ), false ); @@ -566,11 +549,10 @@ contract RoleAuthorizerTest is Test { newModule ) ); - _authorizer.grantRoleFromModule(uint8(ModuleRoles.ROLE_0), BOB); + _authorizer.grantRoleFromModule(ROLE_0, BOB); assertEq( _authorizer.hasRole( - _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_0)), - BOB + _authorizer.generateRoleId(newModule, ROLE_0), BOB ), false ); @@ -589,13 +571,13 @@ contract RoleAuthorizerTest is Test { .selector ) ); - _authorizer.grantRoleFromModule(uint8(ModuleRoles.ROLE_0), BOB); + _authorizer.grantRoleFromModule(ROLE_0, BOB); vm.stopPrank(); assertEq( _authorizer.hasRole( - _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_0)), + _authorizer.generateRoleId(newModule, ROLE_0), BOB ), false @@ -607,17 +589,16 @@ contract RoleAuthorizerTest is Test { vm.startPrank(newModule); - _authorizer.revokeRoleFromModule(uint8(ModuleRoles.ROLE_0), BOB); + _authorizer.revokeRoleFromModule(ROLE_0, BOB); - _authorizer.revokeRoleFromModule(uint8(ModuleRoles.ROLE_0), BOB); + _authorizer.revokeRoleFromModule(ROLE_0, BOB); // No reverts happen vm.stopPrank(); assertEq( _authorizer.hasRole( - _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_0)), - BOB + _authorizer.generateRoleId(newModule, ROLE_0), BOB ), false ); @@ -629,30 +610,30 @@ contract RoleAuthorizerTest is Test { // Grant global roles function testGrantGlobalRole() public { bytes32 globalRole = - _authorizer.generateRoleId(address(_orchestrator), uint8(3)); + _authorizer.generateRoleId(address(_orchestrator), bytes32("0x03")); vm.prank(ALBA); - _authorizer.grantGlobalRole(uint8(3), BOB); + _authorizer.grantGlobalRole(bytes32("0x03"), BOB); assertTrue(_authorizer.hasRole(globalRole, BOB)); } function testGrantGlobalRoleFailsIfNotOwner() public { bytes32 globalRole = - _authorizer.generateRoleId(address(_orchestrator), uint8(3)); + _authorizer.generateRoleId(address(_orchestrator), bytes32("0x03")); vm.prank(BOB); vm.expectRevert(); - _authorizer.grantGlobalRole(uint8(3), ALBA); + _authorizer.grantGlobalRole(bytes32("0x03"), ALBA); assertFalse(_authorizer.hasRole(globalRole, ALBA)); } // Revoke global roles function testRevokeGlobalRole() public { bytes32 globalRole = - _authorizer.generateRoleId(address(_orchestrator), uint8(3)); + _authorizer.generateRoleId(address(_orchestrator), bytes32("0x03")); vm.startPrank(ALBA); - _authorizer.grantGlobalRole(uint8(3), BOB); + _authorizer.grantGlobalRole(bytes32("0x03"), BOB); assertTrue(_authorizer.hasRole(globalRole, BOB)); - _authorizer.revokeGlobalRole(uint8(3), BOB); + _authorizer.revokeGlobalRole(bytes32("0x03"), BOB); assertEq(_authorizer.hasRole(globalRole, BOB), false); vm.stopPrank(); @@ -660,14 +641,14 @@ contract RoleAuthorizerTest is Test { function testRevokeGlobalRoleFailsIfNotOwner() public { bytes32 globalRole = - _authorizer.generateRoleId(address(_orchestrator), uint8(3)); + _authorizer.generateRoleId(address(_orchestrator), bytes32("0x03")); vm.prank(ALBA); - _authorizer.grantGlobalRole(uint8(3), BOB); + _authorizer.grantGlobalRole(bytes32("0x03"), BOB); assertTrue(_authorizer.hasRole(globalRole, BOB)); vm.prank(BOB); vm.expectRevert(); - _authorizer.revokeGlobalRole(uint8(3), BOB); + _authorizer.revokeGlobalRole(bytes32("0x03"), BOB); assertTrue(_authorizer.hasRole(globalRole, BOB)); } @@ -699,8 +680,7 @@ contract RoleAuthorizerTest is Test { //Then we set up a mock module address newModule = _setupMockSelfManagedModule(); - bytes32 roleId = - _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_0)); + bytes32 roleId = _authorizer.generateRoleId(newModule, ROLE_0); // Now we set the OWNER as Role admin vm.startPrank(BOB); @@ -720,8 +700,7 @@ contract RoleAuthorizerTest is Test { //We set up a mock module address newModule = _setupMockSelfManagedModule(); - bytes32 roleId = - _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_0)); + bytes32 roleId = _authorizer.generateRoleId(newModule, ROLE_0); bytes32 ownerRole = _authorizer.getOwnerRole(); //Buffer this to time revert // BOB is not allowed to do this @@ -741,8 +720,7 @@ contract RoleAuthorizerTest is Test { //Then we set up a mock module address newModule = _setupMockSelfManagedModule(); - bytes32 roleId = - _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_0)); + bytes32 roleId = _authorizer.generateRoleId(newModule, ROLE_0); // ALBA can now freely grant and revoke roles assertEq(_authorizer.hasRole(roleId, BOB), false); @@ -776,8 +754,7 @@ contract RoleAuthorizerTest is Test { //Then we set up a mock module and buffer the role with burned admin address newModule = _setupMockSelfManagedModule(); - bytes32 roleId = - _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_1)); + bytes32 roleId = _authorizer.generateRoleId(newModule, ROLE_0); // BOB can NOT grant and revoke roles even though he's admin assertEq(_authorizer.hasRole(roleId, BOB), false); @@ -813,7 +790,7 @@ contract RoleAuthorizerTest is Test { address newModule = _setupMockSelfManagedModule(); vm.startPrank(newModule); - _authorizer.grantRoleFromModule(uint8(ModuleRoles.ROLE_0), BOB); + _authorizer.grantRoleFromModule(ROLE_0, BOB); // BOB is authorized assertTrue(_authorizer.isAuthorized(uint8(ModuleRoles.ROLE_0), BOB)); @@ -847,11 +824,11 @@ contract RoleAuthorizerTest is Test { } */ // Test module can correctly return to managed mode - function testModuleReturnToManagedMode() public { + /* function testModuleReturnToManagedMode() public { //testModuleOnlyUsesOrchestratorRolesWhenNotSelfManaged implicitly tests this - } + } */ - // Test the burnAdminRole + // Test the burnAdminFromModuleRole // -> Test burnAdmin changes state function testBurnAdminChangesRoleState() public { // _setupMockSelfManagedModule implicitly test this @@ -867,10 +844,8 @@ contract RoleAuthorizerTest is Test { //Then we set up a mock module and buffer both roles address newModule = _setupMockSelfManagedModule(); - bytes32 roleId_0 = - _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_0)); - bytes32 roleId_1 = - _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_1)); + bytes32 roleId_0 = _authorizer.generateRoleId(newModule, ROLE_0); + bytes32 roleId_1 = _authorizer.generateRoleId(newModule, ROLE_0); vm.startPrank(BOB); @@ -931,14 +906,12 @@ contract RoleAuthorizerTest is Test { _orchestrator.addModule(address(mockModule)); vm.startPrank(address(mockModule)); - _authorizer.burnAdminRole(uint8(ModuleRoles.ROLE_1)); + _authorizer.burnAdminFromModuleRole(ROLE_0); vm.stopPrank(); bytes32 burntAdmin = _authorizer.getRoleAdmin( - _authorizer.generateRoleId( - address(mockModule), uint8(ModuleRoles.ROLE_1) - ) + _authorizer.generateRoleId(address(mockModule), ROLE_0) ); assertTrue(burntAdmin == _authorizer.BURN_ADMIN_ROLE()); diff --git a/test/modules/authorizer/SingleVoteGovernor.t.sol b/test/modules/authorizer/SingleVoteGovernor.t.sol index 1b9a5daa5..aff9b692d 100644 --- a/test/modules/authorizer/SingleVoteGovernor.t.sol +++ b/test/modules/authorizer/SingleVoteGovernor.t.sol @@ -224,13 +224,13 @@ contract SingleVoteGovernorTest is ModuleTest { function testInit() public override(ModuleTest) { assertEq(_orchestrator.isModule(address(_governor)), true); - assertEq(_authorizer.isAuthorized(address(_governor)), true); + assertEq(_authorizer.hasRole("0x01", address(_governor)), true); // Owner role assertEq(_governor.isVoter(ALBA), true); assertEq(_governor.isVoter(BOB), true); assertEq(_governor.isVoter(COBIE), true); - assertEq(_authorizer.isAuthorized(address(this)), false); - assertEq(_authorizer.isAuthorized(address(_orchestrator)), false); + assertEq(_authorizer.hasRole("0x01", address(this)), false); + assertEq(_authorizer.hasRole("0x01", address(_orchestrator)), false); assertEq(_governor.isVoter(address(this)), false); assertEq(_governor.isVoter(address(_orchestrator)), false); @@ -328,7 +328,7 @@ contract SingleVoteGovernorTest is ModuleTest { ) ); - assertEq(_authorizer.isAuthorized(address(_governor)), true); + assertEq(_authorizer.hasRole("0x01", address(_governor)), true); assertEq(_governor.isVoter(ALBA), true); assertEq(_governor.isVoter(BOB), true); assertEq(_governor.isVoter(COBIE), true); diff --git a/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol b/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol index 5962db877..0fed31360 100644 --- a/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol +++ b/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol @@ -96,10 +96,8 @@ contract TokenGatedRoleAuthorizerTest is Test { ERC721Mock internal roleNft = new ERC721Mock("detrevnI epA thcaY bulC", "EPA"); - enum ModuleRoles { - ROLE_TOKEN, - ROLE_NFT - } + bytes32 immutable ROLE_TOKEN = "ROLE_TOKEN"; + bytes32 immutable ROLE_NFT = "ROLE_NFT"; // Orchestrator Constants uint internal constant _ORCHESTRATOR_ID = 1; @@ -160,7 +158,7 @@ contract TokenGatedRoleAuthorizerTest is Test { // function set up tokenGated role with threshold function setUpTokenGatedRole( address module, - uint8 role, + bytes32 role, address token, uint threshold ) internal returns (bytes32) { @@ -174,7 +172,7 @@ contract TokenGatedRoleAuthorizerTest is Test { } //function set up nftGated role - function setUpNFTGatedRole(address module, uint8 role, address nft) + function setUpNFTGatedRole(address module, bytes32 role, address nft) internal returns (bytes32) { @@ -201,16 +199,12 @@ contract TokenGatedRoleAuthorizerTest is Test { function testMakeRoleTokenGated() public { bytes32 roleId_1 = setUpTokenGatedRole( - address(mockModule), - uint8(ModuleRoles.ROLE_TOKEN), - address(roleToken), - 500 + address(mockModule), ROLE_TOKEN, address(roleToken), 500 ); assertTrue(_authorizer.isTokenGated(roleId_1)); - bytes32 roleId_2 = setUpNFTGatedRole( - address(mockModule), uint8(ModuleRoles.ROLE_NFT), address(roleNft) - ); + bytes32 roleId_2 = + setUpNFTGatedRole(address(mockModule), ROLE_NFT, address(roleNft)); assertTrue(_authorizer.isTokenGated(roleId_2)); } @@ -221,8 +215,7 @@ contract TokenGatedRoleAuthorizerTest is Test { //we set and unset on an empty role - bytes32 roleId = - _authorizer.generateRoleId(address(mockModule), uint8(0)); + bytes32 roleId = _authorizer.generateRoleId(address(mockModule), "0x00"); //now we make it tokengated as admin vm.prank(CLOE); @@ -239,13 +232,12 @@ contract TokenGatedRoleAuthorizerTest is Test { //test makeTokenGated fails if not empty function testMakingFunctionTokenGatedFailsIfAlreadyInUse() public { - bytes32 roleId = _authorizer.generateRoleId( - address(mockModule), uint8(ModuleRoles.ROLE_TOKEN) - ); + bytes32 roleId = + _authorizer.generateRoleId(address(mockModule), ROLE_TOKEN); //we switch on self-management and whitelist an address vm.startPrank(address(mockModule)); - _authorizer.grantRoleFromModule(uint8(ModuleRoles.ROLE_TOKEN), CLOE); + _authorizer.grantRoleFromModule(ROLE_TOKEN, CLOE); vm.expectRevert( abi.encodeWithSelector( @@ -254,14 +246,14 @@ contract TokenGatedRoleAuthorizerTest is Test { .selector ) ); - _authorizer.makeRoleTokenGatedFromModule(uint8(ModuleRoles.ROLE_TOKEN)); + _authorizer.makeRoleTokenGatedFromModule(ROLE_TOKEN); assertFalse(_authorizer.isTokenGated(roleId)); //we revoke the whitelist - _authorizer.revokeRoleFromModule(uint8(ModuleRoles.ROLE_TOKEN), CLOE); + _authorizer.revokeRoleFromModule(ROLE_TOKEN, CLOE); // now it works: - _authorizer.makeRoleTokenGatedFromModule(uint8(ModuleRoles.ROLE_TOKEN)); + _authorizer.makeRoleTokenGatedFromModule(ROLE_TOKEN); assertTrue(_authorizer.isTokenGated(roleId)); } // smae but with admin @@ -270,13 +262,12 @@ contract TokenGatedRoleAuthorizerTest is Test { // we set BOB as admin makeAddressDefaultAdmin(BOB); - bytes32 roleId = _authorizer.generateRoleId( - address(mockModule), uint8(ModuleRoles.ROLE_TOKEN) - ); + bytes32 roleId = + _authorizer.generateRoleId(address(mockModule), ROLE_TOKEN); //we switch on self-management and whitelist an address vm.prank(address(mockModule)); - _authorizer.grantRoleFromModule(uint8(ModuleRoles.ROLE_TOKEN), CLOE); + _authorizer.grantRoleFromModule(ROLE_TOKEN, CLOE); vm.startPrank(BOB); @@ -313,23 +304,15 @@ contract TokenGatedRoleAuthorizerTest is Test { // -> yes case function testCanAddTokenWhenTokenGated() public { setUpTokenGatedRole( - address(mockModule), - uint8(ModuleRoles.ROLE_TOKEN), - address(roleToken), - 500 - ); - setUpNFTGatedRole( - address(mockModule), uint8(ModuleRoles.ROLE_NFT), address(roleNft) + address(mockModule), ROLE_TOKEN, address(roleToken), 500 ); + setUpNFTGatedRole(address(mockModule), ROLE_NFT, address(roleNft)); } // -> no case function testCannotAddNonTokenWhenTokenGated() public { setUpTokenGatedRole( - address(mockModule), - uint8(ModuleRoles.ROLE_TOKEN), - address(roleToken), - 500 + address(mockModule), ROLE_TOKEN, address(roleToken), 500 ); vm.prank(address(mockModule)); @@ -344,7 +327,7 @@ contract TokenGatedRoleAuthorizerTest is Test { CLOE ) ); - _authorizer.grantRoleFromModule(uint8(ModuleRoles.ROLE_TOKEN), CLOE); + _authorizer.grantRoleFromModule(ROLE_TOKEN, CLOE); } function testAdminCannotAddNonTokenWhenTokenGated() public { @@ -352,10 +335,7 @@ contract TokenGatedRoleAuthorizerTest is Test { makeAddressDefaultAdmin(BOB); bytes32 roleId = setUpTokenGatedRole( - address(mockModule), - uint8(ModuleRoles.ROLE_TOKEN), - address(roleToken), - 500 + address(mockModule), ROLE_TOKEN, address(roleToken), 500 ); vm.prank(BOB); @@ -377,10 +357,7 @@ contract TokenGatedRoleAuthorizerTest is Test { // yes case function testSetThreshold() public { bytes32 roleId = setUpTokenGatedRole( - address(mockModule), - uint8(ModuleRoles.ROLE_TOKEN), - address(roleToken), - 500 + address(mockModule), ROLE_TOKEN, address(roleToken), 500 ); assertEq(_authorizer.getThresholdValue(roleId, address(roleToken)), 500); } @@ -388,7 +365,7 @@ contract TokenGatedRoleAuthorizerTest is Test { // invalid threshold from module function testSetThresholdFailsIfInvalid() public { - uint8 role = uint8(ModuleRoles.ROLE_TOKEN); + bytes32 role = ROLE_TOKEN; vm.startPrank(address(mockModule)); _authorizer.makeRoleTokenGatedFromModule(role); @@ -411,10 +388,7 @@ contract TokenGatedRoleAuthorizerTest is Test { makeAddressDefaultAdmin(BOB); //First we set up a valid role bytes32 roleId = setUpTokenGatedRole( - address(mockModule), - uint8(ModuleRoles.ROLE_TOKEN), - address(roleToken), - 500 + address(mockModule), ROLE_TOKEN, address(roleToken), 500 ); // and we try to break it @@ -444,13 +418,12 @@ contract TokenGatedRoleAuthorizerTest is Test { ) ); _authorizer.grantTokenRoleFromModule( - uint8(ModuleRoles.ROLE_TOKEN), address(roleToken), 500 + ROLE_TOKEN, address(roleToken), 500 ); //also fails for the admin - bytes32 roleId = _authorizer.generateRoleId( - address(mockModule), uint8(ModuleRoles.ROLE_TOKEN) - ); + bytes32 roleId = + _authorizer.generateRoleId(address(mockModule), ROLE_TOKEN); vm.prank(BOB); vm.expectRevert( @@ -482,10 +455,7 @@ contract TokenGatedRoleAuthorizerTest is Test { roleToken.burn(CLOE, 10); bytes32 roleId = setUpTokenGatedRole( - address(mockModule), - uint8(ModuleRoles.ROLE_TOKEN), - address(roleToken), - threshold + address(mockModule), ROLE_TOKEN, address(roleToken), threshold ); for (uint i = 0; i < callers.length; i++) { @@ -498,9 +468,7 @@ contract TokenGatedRoleAuthorizerTest is Test { //we ensure both ways to check give the same result vm.prank(address(mockModule)); - bool result = _authorizer.isAuthorized( - uint8(ModuleRoles.ROLE_TOKEN), callers[i] - ); + bool result = _authorizer.hasModuleRole(ROLE_TOKEN, callers[i]); assertEq(result, _authorizer.hasTokenRole(roleId, callers[i])); // we verify the result ir correct @@ -531,9 +499,8 @@ contract TokenGatedRoleAuthorizerTest is Test { //We burn the token created on setup roleNft.burn(roleNft.idCounter() - 1); - bytes32 roleId = setUpNFTGatedRole( - address(mockModule), uint8(ModuleRoles.ROLE_NFT), address(roleNft) - ); + bytes32 roleId = + setUpNFTGatedRole(address(mockModule), ROLE_NFT, address(roleNft)); for (uint i = 0; i < callers.length; i++) { if (callers[i] == address(0)) { @@ -546,9 +513,7 @@ contract TokenGatedRoleAuthorizerTest is Test { //we ensure both ways to check give the same result vm.prank(address(mockModule)); - bool result = _authorizer.isAuthorized( - uint8(ModuleRoles.ROLE_NFT), callers[i] - ); + bool result = _authorizer.hasModuleRole(ROLE_NFT, callers[i]); assertEq(result, _authorizer.hasTokenRole(roleId, callers[i])); // we verify the result ir correct diff --git a/test/modules/base/Module.t.sol b/test/modules/base/Module.t.sol index 0bdf68655..9354ac430 100644 --- a/test/modules/base/Module.t.sol +++ b/test/modules/base/Module.t.sol @@ -35,14 +35,6 @@ contract baseModuleTest is ModuleTest { // SuT ModuleMock module; - enum mockRoles { - ROLE_1, - ROLE_2, - ROLE_3, - ROLE_4, - ROLE_5 - } - bytes _CONFIGDATA = bytes(""); function setUp() public { @@ -125,23 +117,22 @@ contract baseModuleTest is ModuleTest { //-------------------------------------------------------------------------- // Role Functions - function testGrantModuleRole(uint8 role, address addr) public { - vm.assume(role <= uint8(type(mockRoles).max)); + function testGrantModuleRole(bytes32 role, address addr) public { vm.assume(addr != address(0)); vm.startPrank(address(this)); - module.grantModuleRole(role, addr); + module.grantModuleRole( role, addr); - bytes32 roleId = _authorizer.generateRoleId(address(module), role); + bytes32 roleId = + _authorizer.generateRoleId(address(module), role); bool isAuthorized = _authorizer.checkRoleMembership(roleId, addr); assertTrue(isAuthorized); vm.stopPrank(); } - function testRevokeModuleRole(uint8 role, address addr) public { - vm.assume(role <= uint8(type(mockRoles).max)); + function testRevokeModuleRole(bytes32 role, address addr) public { vm.assume(addr != address(0)); vm.startPrank(address(this)); diff --git a/test/orchestrator/Orchestrator.t.sol b/test/orchestrator/Orchestrator.t.sol index e1dda6bcb..8386a8ba5 100644 --- a/test/orchestrator/Orchestrator.t.sol +++ b/test/orchestrator/Orchestrator.t.sol @@ -218,8 +218,11 @@ contract OrchestratorTest is Test { // verify whether the init value is set and not the value from the old // authorizer, to check whether the replacement is successful - assertFalse(orchestrator.authorizer().isAuthorized(address(this))); - assertTrue(orchestrator.authorizer().isAuthorized(address(0xA11CE))); + bytes32 ownerRole = orchestrator.authorizer().getOwnerRole(); + assertFalse(orchestrator.authorizer().hasRole(ownerRole, address(this))); + assertTrue( + orchestrator.authorizer().hasRole(ownerRole, address(0xA11CE)) + ); } function testSetFundingManager( diff --git a/test/utils/mocks/modules/AuthorizerMock.sol b/test/utils/mocks/modules/AuthorizerMock.sol index 03957ee97..85349d14e 100644 --- a/test/utils/mocks/modules/AuthorizerMock.sol +++ b/test/utils/mocks/modules/AuthorizerMock.sol @@ -37,10 +37,8 @@ contract AuthorizerMock is IAuthorizer, Module { _authorized[authorized] = true; - _roleAuthorized[generateRoleId(address(orchestrator()), uint8(0))][msg - .sender] = true; - _roleAuthorized[generateRoleId(address(orchestrator()), uint8(1))][msg - .sender] = true; + _roleAuthorized["0x01"][msg.sender] = true; + _roleAuthorized["0x02"][msg.sender] = true; } function mockInit(bytes memory configData) public { @@ -55,7 +53,7 @@ contract AuthorizerMock is IAuthorizer, Module { // IAuthorizer Functions // Also accepts the owner role as authorized. - function isAuthorized(address who) external view returns (bool) { + /* function isAuthorized(address who) external view returns (bool) { return _authorized[who] || _allAuthorized || _roleAuthorized[generateRoleId(address(orchestrator()), uint8(0))][who]; } @@ -73,8 +71,8 @@ contract AuthorizerMock is IAuthorizer, Module { || _roleAuthorized[generateRoleId(address(orchestrator()), uint8(1))][who] || _allAuthorized; } - - function generateRoleId(address module, uint8 role) + */ + function generateRoleId(address module, bytes32 role) public pure returns (bytes32) @@ -82,12 +80,12 @@ contract AuthorizerMock is IAuthorizer, Module { return keccak256(abi.encodePacked(module, role)); } - function grantRoleFromModule(uint8 role, address target) external { + function grantRoleFromModule(bytes32 role, address target) external { console.log(_msgSender()); _roleAuthorized[generateRoleId(_msgSender(), role)][target] = true; } - function revokeRoleFromModule(uint8 role, address target) external { + function revokeRoleFromModule(bytes32 role, address target) external { _roleAuthorized[generateRoleId(_msgSender(), role)][target] = false; } @@ -95,7 +93,7 @@ contract AuthorizerMock is IAuthorizer, Module { function transferAdminRole(bytes32, bytes32) external {} - function burnAdminRole(uint8) external {} + function burnAdminFromModuleRole(bytes32) external {} //IAccessControlUpgradeable @@ -119,6 +117,16 @@ contract AuthorizerMock is IAuthorizer, Module { return _authorized[who] || _roleAuthorized[role][who] || _allAuthorized; } + function hasModuleRole(bytes32 role, address who) + external + view + returns (bool) + { + bytes32 roleId = generateRoleId(_msgSender(), role); + return + _authorized[who] || _roleAuthorized[roleId][who] || _allAuthorized; + } + function checkRoleMembership(bytes32 role, address who) external view @@ -134,18 +142,18 @@ contract AuthorizerMock is IAuthorizer, Module { function renounceRole(bytes32, address) external pure {} function getOwnerRole() external view returns (bytes32) { - return generateRoleId(address(orchestrator()), uint8(0)); + return "0x01"; } function getManagerRole() external view returns (bytes32) { - return generateRoleId(address(orchestrator()), uint8(1)); + return "0x02"; } /// @notice Grants a global role to a target /// @param role The role to grant /// @param target The address to grant the role to /// @dev Only the addresses with the Owner role should be able to call this function - function grantGlobalRole(uint8 role, address target) external { + function grantGlobalRole(bytes32 role, address target) external { bytes32 roleID = generateRoleId(address(orchestrator()), role); grantRole(roleID, target); } @@ -154,7 +162,7 @@ contract AuthorizerMock is IAuthorizer, Module { /// @param role The role to grant /// @param target The address to grant the role to /// @dev Only the addresses with the Owner role should be able to call this function - function revokeGlobalRole(uint8 role, address target) external { + function revokeGlobalRole(bytes32 role, address target) external { bytes32 roleID = generateRoleId(address(orchestrator()), role); revokeRole(roleID, target); } From 9c1d106f3a5d31e1e5ba4a2f8d9b22790d36d5a7 Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Tue, 15 Aug 2023 16:22:02 +0200 Subject: [PATCH 25/32] forge update --- lib/forge-std | 2 +- lib/openzeppelin-contracts | 2 +- lib/openzeppelin-contracts-upgradeable | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/forge-std b/lib/forge-std index fc560fa34..1cefc0e4e 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit fc560fa34fa12a335a50c35d92e55a6628ca467c +Subproject commit 1cefc0e4e3d2a1f604c654004c90bd6701b2b5e2 diff --git a/lib/openzeppelin-contracts b/lib/openzeppelin-contracts index db9ee953a..9e3f4d60c 160000 --- a/lib/openzeppelin-contracts +++ b/lib/openzeppelin-contracts @@ -1 +1 @@ -Subproject commit db9ee953a17166a51fff42b3c4a29203ef92a492 +Subproject commit 9e3f4d60c581010c4a3979480e07cc7752f124cc diff --git a/lib/openzeppelin-contracts-upgradeable b/lib/openzeppelin-contracts-upgradeable index f6c4c9c4e..0a670d08c 160000 --- a/lib/openzeppelin-contracts-upgradeable +++ b/lib/openzeppelin-contracts-upgradeable @@ -1 +1 @@ -Subproject commit f6c4c9c4ec601665ca74d2c9dddf547fc425658c +Subproject commit 0a670d08c1364dd91ed50564405ede08f172ef0e From e1027818fc6773e4b319b5f3c854de85846d6997 Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Wed, 16 Aug 2023 13:29:45 +0200 Subject: [PATCH 26/32] fix test setup funcs --- lib/openzeppelin-contracts | 2 +- lib/openzeppelin-contracts-upgradeable | 2 +- script/setup/SetupToyOrchestratorScript.s.sol | 3 ++- src/modules/authorizer/RoleAuthorizer.sol | 11 +++----- src/modules/base/Module.sol | 6 ++--- test/modules/authorizer/RoleAuthorizer.t.sol | 27 +++++++++++-------- test/modules/base/Module.t.sol | 5 ++-- test/modules/logicModule/BountyManager.t.sol | 21 +++++---------- 8 files changed, 35 insertions(+), 42 deletions(-) diff --git a/lib/openzeppelin-contracts b/lib/openzeppelin-contracts index 9e3f4d60c..54b3f1434 160000 --- a/lib/openzeppelin-contracts +++ b/lib/openzeppelin-contracts @@ -1 +1 @@ -Subproject commit 9e3f4d60c581010c4a3979480e07cc7752f124cc +Subproject commit 54b3f14346da01ba0d159114b399197fea8b7cda diff --git a/lib/openzeppelin-contracts-upgradeable b/lib/openzeppelin-contracts-upgradeable index 0a670d08c..f6febd79e 160000 --- a/lib/openzeppelin-contracts-upgradeable +++ b/lib/openzeppelin-contracts-upgradeable @@ -1 +1 @@ -Subproject commit 0a670d08c1364dd91ed50564405ede08f172ef0e +Subproject commit f6febd79e2a3a17e26969dd0d450c6ebd64bf459 diff --git a/script/setup/SetupToyOrchestratorScript.s.sol b/script/setup/SetupToyOrchestratorScript.s.sol index b359c2e6c..796e44ca6 100644 --- a/script/setup/SetupToyOrchestratorScript.s.sol +++ b/script/setup/SetupToyOrchestratorScript.s.sol @@ -216,7 +216,8 @@ contract SetupToyOrchestratorScript is Test, DeploymentScript { vm.startBroadcast(orchestratorOwnerPrivateKey); { orchestratorCreatedBountyManager.grantModuleRole( - uint8(IBountyManager.Roles.BountyAdmin), orchestratorOwner + orchestratorCreatedBountyManager.BOUNTY_ADMIN_ROLE(), + orchestratorOwner ); bytes memory details = "TEST BOUNTY"; diff --git a/src/modules/authorizer/RoleAuthorizer.sol b/src/modules/authorizer/RoleAuthorizer.sol index 8ec16cb5c..b6cacb6e4 100644 --- a/src/modules/authorizer/RoleAuthorizer.sol +++ b/src/modules/authorizer/RoleAuthorizer.sol @@ -28,8 +28,8 @@ contract RoleAuthorizer is mapping(address => bool) public selfManagedModules; // Stored for easy public reference. Other Modules can assume the following roles to exist - bytes32 public ORCHESTRATOR_OWNER_ROLE = "0x01"; - bytes32 public ORCHESTRATOR_MANAGER_ROLE = "0x02"; + bytes32 public constant ORCHESTRATOR_OWNER_ROLE = "0x01"; + bytes32 public constant ORCHESTRATOR_MANAGER_ROLE = "0x02"; bytes32 public constant BURN_ADMIN_ROLE = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; @@ -103,9 +103,6 @@ contract RoleAuthorizer is //We preliminarily grant admin role to the caller _grantRole(ORCHESTRATOR_OWNER_ROLE, _msgSender()); - //We preliminarily grant admin role to the caller - _grantRole(ORCHESTRATOR_OWNER_ROLE, _msgSender()); - // Set up OWNER role structure: // -> set OWNER as admin of itself @@ -146,7 +143,7 @@ contract RoleAuthorizer is // Public functions // View functions -/* + /* /// @inheritdoc IAuthorizer /// @dev Implements the function of the IAuthorizer interface by defauling to check if the caller holds the OWNER role. function isAuthorized(address who) external view returns (bool) { @@ -172,7 +169,7 @@ contract RoleAuthorizer is } return hasRole(roleId, who); } - */ + */ /// @inheritdoc IAuthorizer function hasModuleRole(bytes32 role, address who) external diff --git a/src/modules/base/Module.sol b/src/modules/base/Module.sol index 657702e71..261b5065d 100644 --- a/src/modules/base/Module.sol +++ b/src/modules/base/Module.sol @@ -89,18 +89,18 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { } /// @notice Modifier to guarantee function is only callable by addresses that hold a specific module-assigned role. - modifier onlyModuleRole(uint8 roleId) { + modifier onlyModuleRole(bytes32 role) { if ( !__Module_orchestrator.authorizer().hasRole( __Module_orchestrator.authorizer().generateRoleId( - address(this), roleId + address(this), role ), _msgSender() ) ) { revert Module__CallerNotAuthorized( __Module_orchestrator.authorizer().generateRoleId( - address(this), roleId + address(this), role ), _msgSender() ); diff --git a/test/modules/authorizer/RoleAuthorizer.t.sol b/test/modules/authorizer/RoleAuthorizer.t.sol index ccdff6271..2d6a43e91 100644 --- a/test/modules/authorizer/RoleAuthorizer.t.sol +++ b/test/modules/authorizer/RoleAuthorizer.t.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.0; // SuT import {Test} from "forge-std/Test.sol"; +import "forge-std/console.sol"; import { RoleAuthorizer, @@ -25,7 +26,6 @@ import {PaymentProcessorMock} from contract RoleAuthorizerTest is Test { bool hasDependency; string[] dependencies = new string[](0); - address initialManager = address(this); // Mocks RoleAuthorizer _authorizer; @@ -68,17 +68,22 @@ contract RoleAuthorizerTest is Test { ); address initialAuth = ALBA; + address initialManager = address(this); _authorizer.init( IOrchestrator(_orchestrator), _METADATA, abi.encode(initialAuth, initialManager) ); + + //console.log(_authorizer.hasRole(_authorizer.getManagerRole(), initialManager)); assertEq( _authorizer.hasRole(_authorizer.getManagerRole(), address(this)), true ); + //console.log(_authorizer.hasRole(_authorizer.getOwnerRole(), ALBA)); assertEq(_authorizer.hasRole(_authorizer.getOwnerRole(), ALBA), true); + //console.log(_authorizer.hasRole(_authorizer.getOwnerRole(), address(this))); assertEq( _authorizer.hasRole(_authorizer.getOwnerRole(), address(this)), false @@ -141,14 +146,14 @@ contract RoleAuthorizerTest is Test { Orchestrator newOrchestrator = Orchestrator(Clones.clone(address(new Orchestrator()))); - address[] memory initialAuth = new address[](1); - initialAuth[0] = address(this); + address initialOwner = address(this); + address initialManager = address(this); vm.expectRevert(); _authorizer.init( IOrchestrator(newOrchestrator), _METADATA, - abi.encode(initialAuth, initialManager) + abi.encode(initialOwner, initialManager) ); assertEq(_authorizer.hasRole("0x01", address(this)), false); assertEq(address(_authorizer.orchestrator()), address(_orchestrator)); @@ -731,9 +736,9 @@ contract RoleAuthorizerTest is Test { assertEq(_authorizer.hasRole(roleId, BOB), false); vm.stopPrank(); - // The module returns to Managed mode - vm.prank(newModule); + //TODO reiew if this test is still necessary + /* // ALBA can still freely grant and revoke roles assertEq(_authorizer.hasRole(roleId, BOB), false); vm.startPrank(ALBA); @@ -741,7 +746,7 @@ contract RoleAuthorizerTest is Test { assertEq(_authorizer.hasRole(roleId, BOB), true); _authorizer.revokeRole(roleId, BOB); assertEq(_authorizer.hasRole(roleId, BOB), false); - vm.stopPrank(); + vm.stopPrank();*/ } // Test that ADMIN cannot change module roles if admin role was burned @@ -754,7 +759,7 @@ contract RoleAuthorizerTest is Test { //Then we set up a mock module and buffer the role with burned admin address newModule = _setupMockSelfManagedModule(); - bytes32 roleId = _authorizer.generateRoleId(newModule, ROLE_0); + bytes32 roleId = _authorizer.generateRoleId(newModule, ROLE_1); // BOB can NOT grant and revoke roles even though he's admin assertEq(_authorizer.hasRole(roleId, BOB), false); @@ -845,7 +850,7 @@ contract RoleAuthorizerTest is Test { //Then we set up a mock module and buffer both roles address newModule = _setupMockSelfManagedModule(); bytes32 roleId_0 = _authorizer.generateRoleId(newModule, ROLE_0); - bytes32 roleId_1 = _authorizer.generateRoleId(newModule, ROLE_0); + bytes32 roleId_1 = _authorizer.generateRoleId(newModule, ROLE_1); vm.startPrank(BOB); @@ -906,12 +911,12 @@ contract RoleAuthorizerTest is Test { _orchestrator.addModule(address(mockModule)); vm.startPrank(address(mockModule)); - _authorizer.burnAdminFromModuleRole(ROLE_0); + _authorizer.burnAdminFromModuleRole(ROLE_1); vm.stopPrank(); bytes32 burntAdmin = _authorizer.getRoleAdmin( - _authorizer.generateRoleId(address(mockModule), ROLE_0) + _authorizer.generateRoleId(address(mockModule), ROLE_1) ); assertTrue(burntAdmin == _authorizer.BURN_ADMIN_ROLE()); diff --git a/test/modules/base/Module.t.sol b/test/modules/base/Module.t.sol index 9354ac430..a77cefec0 100644 --- a/test/modules/base/Module.t.sol +++ b/test/modules/base/Module.t.sol @@ -122,10 +122,9 @@ contract baseModuleTest is ModuleTest { vm.startPrank(address(this)); - module.grantModuleRole( role, addr); + module.grantModuleRole(role, addr); - bytes32 roleId = - _authorizer.generateRoleId(address(module), role); + bytes32 roleId = _authorizer.generateRoleId(address(module), role); bool isAuthorized = _authorizer.checkRoleMembership(roleId, addr); assertTrue(isAuthorized); diff --git a/test/modules/logicModule/BountyManager.t.sol b/test/modules/logicModule/BountyManager.t.sol index 91c1ce678..fb5c337f9 100644 --- a/test/modules/logicModule/BountyManager.t.sol +++ b/test/modules/logicModule/BountyManager.t.sol @@ -376,13 +376,12 @@ contract BountyManagerTest is ModuleTest { _authorizer.setIsAuthorized(address(this), false); //onlyBountyAdmin - //TODO: Update Role mention + //TODO: Update Role mention vm.expectRevert( abi.encodeWithSelector( IModule.Module__CallerNotAuthorized.selector, _authorizer.generateRoleId( - address(bountyManager), - uint8(IBountyManager.Roles.BountyAdmin) + address(bountyManager), bountyManager.BOUNTY_ADMIN_ROLE() ), address(this) ) @@ -461,13 +460,11 @@ contract BountyManagerTest is ModuleTest { _authorizer.setIsAuthorized(address(this), false); //onlyClaimAdmin - //TODO: Update Role mention vm.expectRevert( abi.encodeWithSelector( IModule.Module__CallerNotAuthorized.selector, _authorizer.generateRoleId( - address(bountyManager), - uint8(IBountyManager.Roles.ClaimAdmin) + address(bountyManager), bountyManager.CLAIM_ADMIN_ROLE() ), address(this) ) @@ -502,13 +499,11 @@ contract BountyManagerTest is ModuleTest { _authorizer.setIsAuthorized(address(this), false); //onlyBountyAdmin - //TODO: Update Role mention vm.expectRevert( abi.encodeWithSelector( IModule.Module__CallerNotAuthorized.selector, _authorizer.generateRoleId( - address(bountyManager), - uint8(IBountyManager.Roles.BountyAdmin) + address(bountyManager), bountyManager.BOUNTY_ADMIN_ROLE() ), address(this) ) @@ -552,13 +547,11 @@ contract BountyManagerTest is ModuleTest { _authorizer.setIsAuthorized(address(this), false); //onlyBountyAdmin - //TODO: Update Role mention vm.expectRevert( abi.encodeWithSelector( IModule.Module__CallerNotAuthorized.selector, _authorizer.generateRoleId( - address(bountyManager), - uint8(IBountyManager.Roles.BountyAdmin) + address(bountyManager), bountyManager.BOUNTY_ADMIN_ROLE() ), address(this) ) @@ -786,13 +779,11 @@ contract BountyManagerTest is ModuleTest { _authorizer.setIsAuthorized(address(this), false); //onlyVerifyAdmin - //TODO: Update Role mention vm.expectRevert( abi.encodeWithSelector( IModule.Module__CallerNotAuthorized.selector, _authorizer.generateRoleId( - address(bountyManager), - uint8(IBountyManager.Roles.VerifyAdmin) + address(bountyManager), bountyManager.VERIFY_ADMIN_ROLE() ), address(this) ) From 35bf37c2413a8c41133cb57d0239a26690510778 Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Wed, 16 Aug 2023 21:45:31 +0200 Subject: [PATCH 27/32] fix rest of tests --- .../authorizer/SingleVoteGovernor.t.sol | 22 ++++++++++++++++--- test/orchestrator/Orchestrator.t.sol | 6 ++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/test/modules/authorizer/SingleVoteGovernor.t.sol b/test/modules/authorizer/SingleVoteGovernor.t.sol index c15ed04a6..f6a7feab7 100644 --- a/test/modules/authorizer/SingleVoteGovernor.t.sol +++ b/test/modules/authorizer/SingleVoteGovernor.t.sol @@ -970,7 +970,11 @@ contract SingleVoteGovernorTest is ModuleTest { vm.assume(_other != address(_governor)); vm.expectRevert( - IOrchestrator.Orchestrator__CallerNotAuthorized.selector + abi.encodeWithSelector( + IOrchestrator.Orchestrator__CallerNotAuthorized.selector, + _authorizer.getOwnerRole(), + _other + ) ); vm.prank(_other); _orchestrator.executeTx(address(0), ""); @@ -1096,7 +1100,13 @@ contract SingleVoteGovernorTest is ModuleTest { uint _newQ = 1; for (uint i; i < users.length; ++i) { - vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); + vm.expectRevert( + abi.encodeWithSelector( + IModule.Module__CallerNotAuthorized.selector, + bytes32("onlySelf"), + users[i] + ) + ); vm.prank(users[i]); //authorized, but not orchestrator _governor.setThreshold(_newQ); } @@ -1183,7 +1193,13 @@ contract SingleVoteGovernorTest is ModuleTest { uint _newDuration = 5 days; for (uint i; i < users.length; ++i) { - vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); + vm.expectRevert( + abi.encodeWithSelector( + IModule.Module__CallerNotAuthorized.selector, + bytes32("onlySelf"), + users[i] + ) + ); vm.prank(users[i]); //authorized, but not orchestrator _governor.setVotingDuration(_newDuration); } diff --git a/test/orchestrator/Orchestrator.t.sol b/test/orchestrator/Orchestrator.t.sol index 8386a8ba5..b07a25807 100644 --- a/test/orchestrator/Orchestrator.t.sol +++ b/test/orchestrator/Orchestrator.t.sol @@ -455,7 +455,11 @@ contract OrchestratorTest is Test { authorizer.setIsAuthorized(address(this), false); vm.expectRevert( - IOrchestrator.Orchestrator__CallerNotAuthorized.selector + abi.encodeWithSelector( + IOrchestrator.Orchestrator__CallerNotAuthorized.selector, + authorizer.getOwnerRole(), + address(this) + ) ); orchestrator.executeTx(address(this), abi.encodeWithSignature("ok()")); } From 2f3b0d645c3142784122949645aeb5ee31e4da7b Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Wed, 16 Aug 2023 22:20:20 +0200 Subject: [PATCH 28/32] add missing test + cleanup --- lcov.info | 2175 ++++++++--------- src/modules/authorizer/IAuthorizer.sol | 20 +- src/modules/authorizer/RoleAuthorizer.sol | 71 +- .../authorizer/TokenGatedRoleAuthorizer.sol | 34 - src/modules/logicModule/IBountyManager.sol | 9 - test/e2e/CreateNewOrchestrator.t.sol | 3 +- test/modules/authorizer/RoleAuthorizer.t.sol | 171 -- .../authorizer/TokenGatedRoleAuthorizer.t.sol | 51 + test/modules/logicModule/BountyManager.t.sol | 1 - test/utils/mocks/modules/AuthorizerMock.sol | 4 +- 10 files changed, 1133 insertions(+), 1406 deletions(-) diff --git a/lcov.info b/lcov.info index f8492315e..79f538f2d 100644 --- a/lcov.info +++ b/lcov.info @@ -272,15 +272,16 @@ DA:210,0 DA:211,0 DA:216,0 DA:218,0 -DA:222,0 -DA:224,0 -DA:228,0 -DA:237,0 -DA:240,0 -DA:242,0 +DA:223,0 +DA:225,0 +DA:229,0 +DA:231,0 +DA:233,0 +DA:236,0 +DA:238,0 FNF:1 FNH:0 -LF:60 +LF:61 LH:0 BRF:2 BRH:0 @@ -405,51 +406,51 @@ end_of_record TN: SF:src/factories/OrchestratorFactory.sol FN:73,OrchestratorFactory.createOrchestrator -FNDA:13229,OrchestratorFactory.createOrchestrator -DA:80,13229 -DA:83,13229 -DA:86,13229 -DA:93,13229 -DA:100,13229 -DA:107,13229 -DA:108,13229 -DA:109,13229 -DA:110,12442 -DA:117,13229 +FNDA:13280,OrchestratorFactory.createOrchestrator +DA:80,13280 +DA:83,13280 +DA:86,13280 +DA:93,13280 +DA:100,13280 +DA:107,13280 +DA:108,13280 +DA:109,13280 +DA:110,12388 +DA:117,13280 BRDA:117,0,0,- -BRDA:117,0,1,13229 +BRDA:117,0,1,13280 DA:118,0 -DA:122,13229 -DA:134,13229 -DA:135,12442 +DA:122,13280 +DA:134,13280 +DA:135,12388 BRDA:135,1,0,- BRDA:135,1,1,3 DA:136,3 -DA:143,13229 +DA:143,13280 BRDA:143,2,0,- BRDA:143,2,1,- DA:144,0 -DA:148,13229 +DA:148,13280 BRDA:148,3,0,- BRDA:148,3,1,- DA:149,0 -DA:153,13229 +DA:153,13280 BRDA:153,4,0,- BRDA:153,4,1,- DA:155,0 -DA:160,13229 +DA:160,13280 FN:164,OrchestratorFactory.getOrchestratorByID -FNDA:6423,OrchestratorFactory.getOrchestratorByID -DA:170,6204 +FNDA:6454,OrchestratorFactory.getOrchestratorByID +DA:170,6236 FN:173,OrchestratorFactory.getOrchestratorIDCounter FNDA:256,OrchestratorFactory.getOrchestratorIDCounter DA:174,256 FN:177,OrchestratorFactory.decoder -FNDA:104258,OrchestratorFactory.decoder -DA:182,104258 +FNDA:104456,OrchestratorFactory.decoder +DA:182,104456 FN:185,OrchestratorFactory._dependencyInjectionRequired -FNDA:52129,OrchestratorFactory._dependencyInjectionRequired -DA:190,52129 +FNDA:52228,OrchestratorFactory._dependencyInjectionRequired +DA:190,52228 FNF:5 FNH:5 LF:26 @@ -460,8 +461,8 @@ end_of_record TN: SF:src/factories/beacon/Beacon.sol FN:40,Beacon.implementation -FNDA:13188,Beacon.implementation -DA:41,13188 +FNDA:13200,Beacon.implementation +DA:41,13200 FN:51,Beacon.upgradeTo FNDA:260,Beacon.upgradeTo DA:52,4 @@ -487,8 +488,8 @@ end_of_record TN: SF:src/factories/beacon/BeaconProxy.sol FN:41,BeaconProxy._implementation -FNDA:14439,BeaconProxy._implementation -DA:42,14439 +FNDA:14451,BeaconProxy._implementation +DA:42,14451 FNF:1 FNH:1 LF:1 @@ -498,153 +499,131 @@ BRH:0 end_of_record TN: SF:src/modules/authorizer/RoleAuthorizer.sol -FN:76,RoleAuthorizer.init +FN:57,RoleAuthorizer.init FNDA:521,RoleAuthorizer.init -DA:81,519 -DA:83,519 +DA:62,519 +DA:64,519 +DA:65,519 +DA:67,519 +FN:70,RoleAuthorizer.__RoleAuthorizer_init +FNDA:519,RoleAuthorizer.__RoleAuthorizer_init +DA:79,519 DA:84,519 DA:86,519 -FN:89,RoleAuthorizer.__RoleAuthorizer_init -FNDA:519,RoleAuthorizer.__RoleAuthorizer_init -DA:98,519 -DA:100,519 -DA:104,519 -DA:109,519 -DA:111,519 -DA:115,519 -DA:117,519 -DA:121,519 -BRDA:121,0,0,517 -BRDA:121,0,1,519 -DA:122,517 -DA:123,517 -FN:133,RoleAuthorizer._revokeRole -FNDA:5469,RoleAuthorizer._revokeRole -DA:139,5467 -FN:149,RoleAuthorizer.isAuthorized -FNDA:55,RoleAuthorizer.isAuthorized -DA:151,55 -FN:155,RoleAuthorizer.isAuthorized -FNDA:1036,RoleAuthorizer.isAuthorized -DA:162,1036 -DA:165,1036 -BRDA:165,1,0,4 -BRDA:165,1,1,1032 -DA:166,4 -DA:168,1032 -DA:170,1036 -FN:174,RoleAuthorizer.generateRoleId -FNDA:2660,RoleAuthorizer.generateRoleId -DA:180,33198 -FN:186,RoleAuthorizer.toggleModuleSelfManagement -FNDA:51,RoleAuthorizer.toggleModuleSelfManagement -DA:187,51 -BRDA:187,2,0,11 -BRDA:187,2,1,40 -DA:188,11 -DA:189,11 -DA:191,40 -DA:192,40 -FN:197,RoleAuthorizer.grantRoleFromModule -FNDA:30,RoleAuthorizer.grantRoleFromModule -DA:202,20 -DA:203,20 -FN:207,RoleAuthorizer.revokeRoleFromModule +DA:90,519 +DA:92,519 +DA:96,519 +BRDA:96,0,0,517 +BRDA:96,0,1,519 +DA:97,517 +DA:98,517 +FN:108,RoleAuthorizer._revokeRole +FNDA:5912,RoleAuthorizer._revokeRole +DA:114,5910 +FN:121,RoleAuthorizer.hasModuleRole +FNDA:27077,RoleAuthorizer.hasModuleRole +DA:128,27077 +DA:129,27077 +FN:133,RoleAuthorizer.generateRoleId +FNDA:593,RoleAuthorizer.generateRoleId +DA:139,29299 +FN:143,RoleAuthorizer.grantRoleFromModule +FNDA:20,RoleAuthorizer.grantRoleFromModule +DA:147,14 +DA:148,14 +FN:152,RoleAuthorizer.revokeRoleFromModule FNDA:9,RoleAuthorizer.revokeRoleFromModule -DA:212,7 -DA:213,7 -FN:217,RoleAuthorizer.transferAdminRole +DA:156,7 +DA:157,7 +FN:161,RoleAuthorizer.transferAdminRole FNDA:4,RoleAuthorizer.transferAdminRole -DA:221,2 -FN:225,RoleAuthorizer.burnAdminRole -FNDA:38,RoleAuthorizer.burnAdminRole -DA:230,38 -DA:231,38 -FN:235,RoleAuthorizer.grantGlobalRole +DA:165,2 +FN:169,RoleAuthorizer.burnAdminFromModuleRole +FNDA:24,RoleAuthorizer.burnAdminFromModuleRole +DA:173,24 +DA:174,24 +FN:178,RoleAuthorizer.grantGlobalRole FNDA:8,RoleAuthorizer.grantGlobalRole -DA:239,6 -DA:240,6 -FN:244,RoleAuthorizer.revokeGlobalRole +DA:182,6 +DA:183,6 +FN:187,RoleAuthorizer.revokeGlobalRole FNDA:4,RoleAuthorizer.revokeGlobalRole -DA:248,2 -DA:249,2 -FN:253,RoleAuthorizer.getOwnerRole -FNDA:12033,RoleAuthorizer.getOwnerRole -DA:254,12033 -FN:258,RoleAuthorizer.getManagerRole -FNDA:0,RoleAuthorizer.getManagerRole -DA:259,0 -FNF:15 -FNH:14 -LF:40 -LH:39 -BRF:6 -BRH:6 +DA:191,2 +DA:192,2 +FN:196,RoleAuthorizer.getOwnerRole +FNDA:11776,RoleAuthorizer.getOwnerRole +DA:197,11776 +FN:201,RoleAuthorizer.getManagerRole +FNDA:2048,RoleAuthorizer.getManagerRole +DA:202,2048 +FNF:13 +FNH:13 +LF:29 +LH:29 +BRF:2 +BRH:2 end_of_record TN: SF:src/modules/authorizer/TokenGatedRoleAuthorizer.sol -FN:62,TokenGatedRoleAuthorizer.isAuthorized -FNDA:26824,TokenGatedRoleAuthorizer.isAuthorized -DA:69,26824 -DA:71,26824 -BRDA:71,0,0,26814 -BRDA:71,0,1,4 -DA:72,26818 -DA:74,26818 -BRDA:74,1,0,26814 -BRDA:74,1,1,4 -DA:75,26814 -DA:77,4 -DA:81,6 -DA:82,6 -FN:90,TokenGatedRoleAuthorizer._grantRole -FNDA:8874,TokenGatedRoleAuthorizer._grantRole -DA:95,8874 -BRDA:95,2,0,- -BRDA:95,2,1,521 -DA:96,521 -DA:102,8874 -FN:109,TokenGatedRoleAuthorizer.hasTokenRole -FNDA:26814,TokenGatedRoleAuthorizer.hasTokenRole -DA:114,53628 -DA:116,53628 -DA:117,53628 -DA:118,53628 -DA:119,53628 -DA:122,53628 -DA:135,31262 -FN:139,TokenGatedRoleAuthorizer.getThresholdValue -FNDA:1,TokenGatedRoleAuthorizer.getThresholdValue -DA:144,1 -DA:145,1 -FN:152,TokenGatedRoleAuthorizer.makeRoleTokenGatedFromModule -FNDA:523,TokenGatedRoleAuthorizer.makeRoleTokenGatedFromModule -DA:158,522 -DA:160,522 -DA:161,522 -FN:165,TokenGatedRoleAuthorizer.grantTokenRoleFromModule -FNDA:522,TokenGatedRoleAuthorizer.grantTokenRoleFromModule -DA:170,522 -DA:171,522 -DA:172,522 -FN:179,TokenGatedRoleAuthorizer.setTokenGated +FN:68,TokenGatedRoleAuthorizer.hasRole +FNDA:16396,TokenGatedRoleAuthorizer.hasRole +DA:75,71593 +BRDA:75,0,0,27600 +BRDA:75,0,1,43993 +DA:76,27600 +DA:78,43993 +FN:86,TokenGatedRoleAuthorizer._grantRole +FNDA:8975,TokenGatedRoleAuthorizer._grantRole +DA:91,8975 +BRDA:91,1,0,- +BRDA:91,1,1,523 +DA:92,523 +DA:98,8975 +FN:105,TokenGatedRoleAuthorizer.hasTokenRole +FNDA:27077,TokenGatedRoleAuthorizer.hasTokenRole +DA:111,54677 +DA:113,54677 +DA:114,54154 +DA:115,54154 +DA:116,54154 +DA:119,54154 +DA:132,29991 +FN:136,TokenGatedRoleAuthorizer.getThresholdValue +FNDA:2,TokenGatedRoleAuthorizer.getThresholdValue +DA:141,2 +DA:142,2 +FN:149,TokenGatedRoleAuthorizer.makeRoleTokenGatedFromModule +FNDA:525,TokenGatedRoleAuthorizer.makeRoleTokenGatedFromModule +DA:154,524 +DA:156,524 +DA:157,524 +FN:161,TokenGatedRoleAuthorizer.grantTokenRoleFromModule +FNDA:524,TokenGatedRoleAuthorizer.grantTokenRoleFromModule +DA:166,524 +DA:167,524 +DA:168,524 +FN:172,TokenGatedRoleAuthorizer.setThresholdFromModule +FNDA:3,TokenGatedRoleAuthorizer.setThresholdFromModule +DA:176,3 +DA:177,3 +FN:184,TokenGatedRoleAuthorizer.setTokenGated FNDA:6,TokenGatedRoleAuthorizer.setTokenGated -DA:184,4 -DA:185,4 -FN:189,TokenGatedRoleAuthorizer.setThreshold +DA:189,4 +DA:190,4 +FN:194,TokenGatedRoleAuthorizer.setThreshold FNDA:2,TokenGatedRoleAuthorizer.setThreshold -DA:193,2 -FN:204,TokenGatedRoleAuthorizer._setThreshold -FNDA:524,TokenGatedRoleAuthorizer._setThreshold -DA:209,520 -DA:210,520 -DA:211,520 -FNF:9 -FNH:9 -LF:32 -LH:32 -BRF:6 -BRH:5 +DA:198,2 +FN:209,TokenGatedRoleAuthorizer._setThreshold +FNDA:529,TokenGatedRoleAuthorizer._setThreshold +DA:214,523 +DA:215,523 +DA:216,523 +FNF:10 +FNH:10 +LF:29 +LH:29 +BRF:4 +BRH:3 end_of_record TN: SF:src/modules/base/Module.sol @@ -678,8 +657,8 @@ FN:200,Module.title FNDA:1,Module.title DA:201,1 FN:205,Module.orchestrator -FNDA:71556,Module.orchestrator -DA:206,571604 +FNDA:72229,Module.orchestrator +DA:206,235916 FN:212,Module.grantModuleRole FNDA:516,Module.grantModuleRole DA:216,516 @@ -710,66 +689,66 @@ end_of_record TN: SF:src/modules/base/mixins/ERC20PaymentClient.sol FN:79,ERC20PaymentClient._addPaymentOrder -FNDA:100134,ERC20PaymentClient._addPaymentOrder -DA:85,100131 -DA:88,100131 -DA:92,100131 -DA:94,100131 +FNDA:101436,ERC20PaymentClient._addPaymentOrder +DA:85,101433 +DA:88,101433 +DA:92,101433 +DA:94,101433 FN:100,ERC20PaymentClient._addPaymentOrders -FNDA:11235,ERC20PaymentClient._addPaymentOrders -DA:101,11235 -DA:103,11235 -DA:105,11235 -DA:106,11235 -DA:107,44587 -DA:108,44587 -DA:111,44587 -DA:114,44587 -DA:116,44587 -DA:120,11235 -DA:124,11235 +FNDA:11503,ERC20PaymentClient._addPaymentOrders +DA:101,11503 +DA:103,11503 +DA:105,11503 +DA:106,11503 +DA:107,43233 +DA:108,43233 +DA:111,43233 +DA:114,43233 +DA:116,43233 +DA:120,11503 +DA:124,11503 FN:131,ERC20PaymentClient.collectPaymentOrders -FNDA:7322,ERC20PaymentClient.collectPaymentOrders -DA:138,7322 +FNDA:7190,ERC20PaymentClient.collectPaymentOrders +DA:138,7190 BRDA:138,0,0,1 -BRDA:138,0,1,7321 +BRDA:138,0,1,7189 DA:139,1 -DA:145,7321 -DA:150,7321 -DA:151,7321 -DA:152,7321 -DA:153,128418 -DA:157,7321 -DA:160,7321 -DA:163,7321 -DA:168,7321 -DA:172,7321 +DA:145,7189 +DA:150,7189 +DA:151,7189 +DA:152,7189 +DA:153,127937 +DA:157,7189 +DA:160,7189 +DA:163,7189 +DA:168,7189 +DA:172,7189 FN:176,ERC20PaymentClient.paymentOrders -FNDA:8601,ERC20PaymentClient.paymentOrders -DA:182,8601 +FNDA:8469,ERC20PaymentClient.paymentOrders +DA:182,8469 FN:186,ERC20PaymentClient.outstandingTokenAmount FNDA:513,ERC20PaymentClient.outstandingTokenAmount DA:187,513 FN:193,ERC20PaymentClient._ensureValidRecipient -FNDA:159371,ERC20PaymentClient._ensureValidRecipient -DA:194,159371 +FNDA:160220,ERC20PaymentClient._ensureValidRecipient +DA:194,160220 BRDA:194,1,0,1 -BRDA:194,1,1,159370 +BRDA:194,1,1,160219 DA:195,1 FN:199,ERC20PaymentClient._ensureValidAmount -FNDA:159413,ERC20PaymentClient._ensureValidAmount -DA:200,159413 +FNDA:160256,ERC20PaymentClient._ensureValidAmount +DA:200,160256 BRDA:200,2,0,1 -BRDA:200,2,1,159412 +BRDA:200,2,1,160255 FN:203,ERC20PaymentClient._ensureValidPaymentOrder -FNDA:144721,ERC20PaymentClient._ensureValidPaymentOrder -DA:204,144721 +FNDA:144669,ERC20PaymentClient._ensureValidPaymentOrder +DA:204,144669 BRDA:204,3,0,1 -BRDA:204,3,1,144720 +BRDA:204,3,1,144668 DA:205,1 -DA:207,144720 +DA:207,144668 BRDA:207,4,0,2 -BRDA:207,4,1,144718 +BRDA:207,4,1,144666 DA:208,2 FNF:8 FNH:8 @@ -790,47 +769,47 @@ DA:72,262 DA:74,262 FN:81,RebasingFundingManager.token FNDA:0,RebasingFundingManager.token -DA:82,75513 +DA:82,79045 FN:86,RebasingFundingManager._supplyTarget -FNDA:28046,RebasingFundingManager._supplyTarget -DA:92,28046 +FNDA:29639,RebasingFundingManager._supplyTarget +DA:92,29639 FN:98,RebasingFundingManager.deposit -FNDA:12530,RebasingFundingManager.deposit -DA:99,12530 +FNDA:13016,RebasingFundingManager.deposit +DA:99,13016 FN:102,RebasingFundingManager.depositFor -FNDA:8171,RebasingFundingManager.depositFor -DA:103,8171 +FNDA:8031,RebasingFundingManager.depositFor +DA:103,8031 FN:106,RebasingFundingManager.withdraw -FNDA:3337,RebasingFundingManager.withdraw -DA:107,3337 +FNDA:3986,RebasingFundingManager.withdraw +DA:107,3986 FN:110,RebasingFundingManager.withdrawTo -FNDA:3240,RebasingFundingManager.withdrawTo -DA:111,3240 +FNDA:3838,RebasingFundingManager.withdrawTo +DA:111,3838 FN:117,RebasingFundingManager.transferOrchestratorToken FNDA:770,RebasingFundingManager.transferOrchestratorToken -DA:122,514 +DA:122,513 FN:128,RebasingFundingManager._deposit -FNDA:20701,RebasingFundingManager._deposit -DA:130,20701 +FNDA:21047,RebasingFundingManager._deposit +DA:130,21047 BRDA:130,0,0,256 -BRDA:130,0,1,20445 +BRDA:130,0,1,20791 DA:131,256 -DA:134,20445 +DA:134,20791 BRDA:134,1,0,- -BRDA:134,1,1,20445 +BRDA:134,1,1,20791 DA:135,0 -DA:138,20445 -DA:140,20445 -DA:142,20445 +DA:138,20791 +DA:140,20791 +DA:142,20791 FN:145,RebasingFundingManager._withdraw -FNDA:6577,RebasingFundingManager._withdraw -DA:146,6577 -DA:148,6577 -DA:150,6577 +FNDA:7824,RebasingFundingManager._withdraw +DA:146,7824 +DA:148,7824 +DA:150,7824 FN:153,RebasingFundingManager._transferOrchestratorToken -FNDA:514,RebasingFundingManager._transferOrchestratorToken -DA:154,514 -DA:156,514 +FNDA:513,RebasingFundingManager._transferOrchestratorToken +DA:154,513 +DA:156,513 FNF:11 FNH:10 LF:25 @@ -841,15 +820,15 @@ end_of_record TN: SF:src/modules/fundingManager/token/ElasticReceiptTokenBase.sol FN:201,ElasticReceiptTokenBase.transfer -FNDA:500,ElasticReceiptTokenBase.transfer -DA:209,500 -DA:211,500 +FNDA:502,ElasticReceiptTokenBase.transfer +DA:209,502 +DA:211,502 DA:213,256 FN:217,ElasticReceiptTokenBase.transferFrom -FNDA:1265,ElasticReceiptTokenBase.transferFrom -DA:226,1265 -DA:228,1265 -DA:229,753 +FNDA:1262,ElasticReceiptTokenBase.transferFrom +DA:226,1262 +DA:228,1262 +DA:229,750 DA:231,512 FN:235,ElasticReceiptTokenBase.transferAll FNDA:256,ElasticReceiptTokenBase.transferAll @@ -869,10 +848,10 @@ DA:269,256 DA:272,512 DA:274,512 FN:278,ElasticReceiptTokenBase.approve -FNDA:2033,ElasticReceiptTokenBase.approve -DA:284,2033 -DA:286,2033 -DA:287,2033 +FNDA:2030,ElasticReceiptTokenBase.approve +DA:284,2030 +DA:286,2030 +DA:287,2030 FN:295,ElasticReceiptTokenBase.increaseAllowance FNDA:512,ElasticReceiptTokenBase.increaseAllowance DA:299,512 @@ -908,8 +887,8 @@ FN:398,ElasticReceiptTokenBase.totalSupply FNDA:779,ElasticReceiptTokenBase.totalSupply DA:399,779 FN:403,ElasticReceiptTokenBase.balanceOf -FNDA:55079,ElasticReceiptTokenBase.balanceOf -DA:404,55079 +FNDA:59937,ElasticReceiptTokenBase.balanceOf +DA:404,59937 FN:408,ElasticReceiptTokenBase.scaledTotalSupply FNDA:2,ElasticReceiptTokenBase.scaledTotalSupply DA:409,2 @@ -923,67 +902,67 @@ FN:426,ElasticReceiptTokenBase.DOMAIN_SEPARATOR FNDA:1,ElasticReceiptTokenBase.DOMAIN_SEPARATOR DA:427,2 FN:442,ElasticReceiptTokenBase._tokensToBits -FNDA:32158,ElasticReceiptTokenBase._tokensToBits -DA:443,32158 +FNDA:33753,ElasticReceiptTokenBase._tokensToBits +DA:443,33753 FN:449,ElasticReceiptTokenBase._bitsToTokens -FNDA:7759,ElasticReceiptTokenBase._bitsToTokens -DA:450,7759 +FNDA:9008,ElasticReceiptTokenBase._bitsToTokens +DA:450,9008 FN:459,ElasticReceiptTokenBase._mint -FNDA:24039,ElasticReceiptTokenBase._mint -DA:466,24012 -BRDA:466,4,0,354 -BRDA:466,4,1,23658 -DA:467,354 -DA:471,23658 -DA:472,23658 -DA:478,23658 -DA:479,23658 -BRDA:479,5,0,4235 -BRDA:479,5,1,23658 -DA:480,4235 -DA:484,23658 -DA:485,23658 -DA:488,23658 +FNDA:24385,ElasticReceiptTokenBase._mint +DA:466,24357 +BRDA:466,4,0,352 +BRDA:466,4,1,24005 +DA:467,352 +DA:471,24005 +DA:472,24005 +DA:478,24005 +DA:479,24005 +BRDA:479,5,0,4236 +BRDA:479,5,1,24005 +DA:480,4236 +DA:484,24005 +DA:485,24005 +DA:488,24005 FN:498,ElasticReceiptTokenBase._burn -FNDA:6735,ElasticReceiptTokenBase._burn -DA:506,6735 -DA:507,6735 -DA:510,6735 -DA:511,6735 -DA:516,6735 -DA:517,6735 -DA:520,6577 -DA:521,6577 -DA:524,6577 +FNDA:7984,ElasticReceiptTokenBase._burn +DA:506,7984 +DA:507,7984 +DA:510,7984 +DA:511,7984 +DA:516,7984 +DA:517,7984 +DA:520,7824 +DA:521,7824 +DA:524,7824 FN:533,ElasticReceiptTokenBase._rebase -FNDA:34840,ElasticReceiptTokenBase._rebase -DA:534,34840 -DA:538,34840 -BRDA:538,6,0,4591 -BRDA:538,6,1,30249 -DA:539,4591 -DA:543,30249 -DA:544,30249 -DA:547,30249 -DA:548,30249 +FNDA:36433,ElasticReceiptTokenBase._rebase +DA:534,36433 +DA:538,36433 +BRDA:538,6,0,4590 +BRDA:538,6,1,31843 +DA:539,4590 +DA:543,31843 +DA:544,31843 +DA:547,31843 +DA:548,31843 FN:553,ElasticReceiptTokenBase._activeBits -FNDA:60644,ElasticReceiptTokenBase._activeBits -DA:554,60644 +FNDA:63834,ElasticReceiptTokenBase._activeBits +DA:554,63834 FN:559,ElasticReceiptTokenBase._transfer -FNDA:32414,ElasticReceiptTokenBase._transfer -DA:562,32414 -DA:563,31929 -DA:565,31929 -BRDA:565,7,0,2423 -BRDA:565,7,1,31929 -DA:566,2423 -DA:569,31929 +FNDA:34009,ElasticReceiptTokenBase._transfer +DA:562,34009 +DA:563,33525 +DA:565,33525 +BRDA:565,7,0,2516 +BRDA:565,7,1,33525 +DA:566,2516 +DA:569,33525 FN:574,ElasticReceiptTokenBase._useAllowance -FNDA:2033,ElasticReceiptTokenBase._useAllowance -DA:578,2033 -BRDA:578,8,0,1777 -BRDA:578,8,1,1265 -DA:579,1777 +FNDA:2030,ElasticReceiptTokenBase._useAllowance +DA:578,2030 +BRDA:578,8,0,1774 +BRDA:578,8,1,1262 +DA:579,1774 FNF:24 FNH:24 LF:78 @@ -1039,158 +1018,157 @@ end_of_record TN: SF:src/modules/logicModule/BountyManager.sol FN:88,BountyManager.validContributorsForBounty -FNDA:158933,BountyManager.validContributorsForBounty -DA:93,158933 -DA:95,158933 -BRDA:95,0,0,9 -BRDA:95,0,1,158924 -DA:96,9 -DA:98,158924 -DA:99,158924 -DA:100,158924 -DA:101,158924 -DA:102,158924 -DA:103,623220 -DA:106,623220 -BRDA:106,1,0,103 -BRDA:106,1,1,623117 -DA:107,103 -DA:110,623117 -DA:112,623117 -DA:113,623102 -BRDA:111,2,0,15 -BRDA:111,2,1,623102 -DA:115,15 -DA:118,623102 -DA:120,623102 -DA:125,158806 -DA:126,158744 -BRDA:124,3,0,90 -BRDA:124,3,1,158716 -DA:128,90 -FN:177,BountyManager.init +FNDA:158009,BountyManager.validContributorsForBounty +DA:93,158009 +DA:95,158009 +BRDA:95,0,0,10 +BRDA:95,0,1,157999 +DA:96,10 +DA:98,157999 +DA:99,157999 +DA:100,157999 +DA:101,157999 +DA:102,157999 +DA:103,637741 +DA:106,637741 +BRDA:106,1,0,105 +BRDA:106,1,1,637636 +DA:107,105 +DA:110,637636 +DA:112,637636 +DA:113,637622 +BRDA:111,2,0,14 +BRDA:111,2,1,637622 +DA:115,14 +DA:118,637622 +DA:120,637622 +DA:125,157880 +DA:126,157824 +BRDA:124,3,0,78 +BRDA:124,3,1,157802 +DA:128,78 +FN:181,BountyManager.init FNDA:5,BountyManager.init -DA:182,4 -DA:184,4 -DA:185,4 -FN:188,BountyManager.init2 +DA:186,4 +DA:188,4 +DA:189,4 +FN:192,BountyManager.init2 FNDA:3,BountyManager.init2 -DA:195,3 -FN:202,BountyManager.getBountyInformation -FNDA:4290,BountyManager.getBountyInformation -DA:208,4060 -FN:212,BountyManager.listBountyIds +FN:205,BountyManager.getBountyInformation +FNDA:4885,BountyManager.getBountyInformation +DA:211,4664 +FN:215,BountyManager.listBountyIds FNDA:0,BountyManager.listBountyIds -DA:213,0 -FN:217,BountyManager.isExistingBountyId +DA:216,0 +FN:220,BountyManager.isExistingBountyId FNDA:2,BountyManager.isExistingBountyId -DA:218,164341 -FN:222,BountyManager.getClaimInformation -FNDA:7186,BountyManager.getClaimInformation -DA:228,6946 -FN:232,BountyManager.listClaimIds +DA:221,164012 +FN:225,BountyManager.getClaimInformation +FNDA:7228,BountyManager.getClaimInformation +DA:231,6991 +FN:235,BountyManager.listClaimIds FNDA:0,BountyManager.listClaimIds -DA:233,0 -FN:237,BountyManager.isExistingClaimId +DA:236,0 +FN:240,BountyManager.isExistingClaimId FNDA:0,BountyManager.isExistingClaimId -DA:238,8812 -FN:242,BountyManager.listClaimIdsForContributorAddress -FNDA:294307,BountyManager.listClaimIdsForContributorAddress -DA:247,294307 -FN:254,BountyManager.addBounty -FNDA:125463,BountyManager.addBounty -DA:265,125333 -DA:268,125333 -DA:270,125333 -DA:272,125333 -DA:273,125333 -DA:274,125333 -DA:276,125333 -DA:280,125333 -FN:284,BountyManager.updateBounty +DA:241,8854 +FN:245,BountyManager.listClaimIdsForContributorAddress +FNDA:310861,BountyManager.listClaimIdsForContributorAddress +DA:250,310861 +FN:257,BountyManager.addBounty +FNDA:135551,BountyManager.addBounty +DA:268,135400 +DA:271,135400 +DA:273,135400 +DA:275,135400 +DA:276,135400 +DA:277,135400 +DA:279,135400 +DA:283,135400 +FN:287,BountyManager.updateBounty FNDA:258,BountyManager.updateBounty -DA:289,256 -DA:291,256 -FN:295,BountyManager.lockBounty +DA:292,256 +DA:294,256 +FN:298,BountyManager.lockBounty FNDA:6,BountyManager.lockBounty -DA:301,3 -DA:303,3 -FN:307,BountyManager.addClaim -FNDA:158679,BountyManager.addClaim -DA:318,158676 -DA:320,158460 -DA:323,158460 -DA:325,158460 -DA:328,158460 -DA:330,158460 -DA:331,158460 -DA:332,608703 -DA:334,608703 -DA:336,608703 -DA:340,158460 -DA:342,158460 -DA:344,158460 -FN:348,BountyManager.updateClaimContributors +DA:304,3 +DA:306,3 +FN:310,BountyManager.addClaim +FNDA:157755,BountyManager.addClaim +DA:321,157752 +DA:323,157546 +DA:326,157546 +DA:328,157546 +DA:331,157546 +DA:333,157546 +DA:334,157546 +DA:335,623551 +DA:337,623551 +DA:339,623551 +DA:343,157546 +DA:345,157546 +DA:347,157546 +FN:351,BountyManager.updateClaimContributors FNDA:260,BountyManager.updateClaimContributors -DA:358,257 -DA:359,256 -DA:361,256 +DA:361,257 DA:362,256 -DA:364,512 -DA:366,512 -DA:370,256 -DA:372,256 -DA:374,256 -DA:375,11302 -DA:377,11302 -DA:379,11302 -DA:383,256 -FN:387,BountyManager.updateClaimDetails +DA:364,256 +DA:365,256 +DA:367,512 +DA:369,512 +DA:373,256 +DA:375,256 +DA:377,256 +DA:378,11406 +DA:380,11406 +DA:382,11406 +DA:386,256 +FN:390,BountyManager.updateClaimDetails FNDA:514,BountyManager.updateClaimDetails -DA:392,259 -DA:394,259 -FN:398,BountyManager.verifyClaim +DA:395,256 +DA:397,256 +FN:401,BountyManager.verifyClaim FNDA:853,BountyManager.verifyClaim -DA:406,669 -DA:408,669 -DA:411,669 -DA:414,669 -DA:417,669 -DA:418,12162 -DA:419,12162 -DA:421,12162 -DA:430,12162 -DA:435,669 -DA:438,669 -DA:443,669 -DA:445,669 -FN:451,BountyManager._ensureTokenBalance -FNDA:12832,BountyManager._ensureTokenBalance -DA:455,12832 -DA:457,12832 -BRDA:457,4,0,- -BRDA:457,4,1,12162 -DA:460,12162 -DA:461,12162 -DA:470,12162 -BRDA:470,5,0,- -BRDA:470,5,1,12162 -DA:471,0 -FN:476,BountyManager._ensureTokenAllowance +DA:409,667 +DA:411,667 +DA:414,667 +DA:417,667 +DA:420,667 +DA:421,12347 +DA:422,12347 +DA:424,12347 +DA:433,12347 +DA:438,667 +DA:441,667 +DA:446,667 +DA:448,667 +FN:454,BountyManager._ensureTokenBalance +FNDA:13015,BountyManager._ensureTokenBalance +DA:458,13015 +DA:460,13015 +BRDA:460,4,0,- +BRDA:460,4,1,12347 +DA:463,12347 +DA:464,12347 +DA:473,12347 +BRDA:473,5,0,- +BRDA:473,5,1,12347 +DA:474,0 +FN:479,BountyManager._ensureTokenAllowance FNDA:1,BountyManager._ensureTokenAllowance -DA:480,1 -DA:481,1 DA:483,1 -BRDA:483,6,0,1 -BRDA:483,6,1,1 DA:484,1 -FN:488,BountyManager._isAuthorizedPaymentProcessor +DA:486,1 +BRDA:486,6,0,1 +BRDA:486,6,1,1 +DA:487,1 +FN:491,BountyManager._isAuthorizedPaymentProcessor FNDA:1,BountyManager._isAuthorizedPaymentProcessor -DA:494,1 +DA:497,1 FNF:20 FNH:17 -LF:95 -LH:92 +LF:94 +LH:91 BRF:14 BRH:12 end_of_record @@ -1206,135 +1184,135 @@ BRDA:98,0,0,2 BRDA:98,0,1,2308 DA:99,2 FN:107,RecurringPaymentManager.getEpochLength -FNDA:41219,RecurringPaymentManager.getEpochLength -DA:108,41219 +FNDA:39201,RecurringPaymentManager.getEpochLength +DA:108,39201 FN:112,RecurringPaymentManager.getRecurringPaymentInformation -FNDA:334740,RecurringPaymentManager.getRecurringPaymentInformation -DA:118,334513 +FNDA:326987,RecurringPaymentManager.getRecurringPaymentInformation +DA:118,326757 FN:122,RecurringPaymentManager.listRecurringPaymentIds -FNDA:14198,RecurringPaymentManager.listRecurringPaymentIds -DA:123,14198 +FNDA:14334,RecurringPaymentManager.listRecurringPaymentIds +DA:123,14334 FN:127,RecurringPaymentManager.getPreviousPaymentId FNDA:0,RecurringPaymentManager.getPreviousPaymentId DA:128,0 FN:132,RecurringPaymentManager.isExistingRecurringPaymentId FNDA:0,RecurringPaymentManager.isExistingRecurringPaymentId -DA:133,336532 +DA:133,328779 FN:140,RecurringPaymentManager.getEpochFromTimestamp FNDA:0,RecurringPaymentManager.getEpochFromTimestamp DA:145,0 FN:149,RecurringPaymentManager.getCurrentEpoch -FNDA:125151,RecurringPaymentManager.getCurrentEpoch -DA:150,296565 +FNDA:125690,RecurringPaymentManager.getCurrentEpoch +DA:150,298215 FN:154,RecurringPaymentManager.getFutureEpoch FNDA:768,RecurringPaymentManager.getFutureEpoch DA:159,768 FN:166,RecurringPaymentManager.addRecurringPayment -FNDA:159414,RecurringPaymentManager.addRecurringPayment -DA:179,159370 -DA:182,159370 -DA:185,159370 -DA:186,159370 -DA:187,159370 -DA:188,159370 -DA:190,159370 -DA:198,159370 +FNDA:160257,RecurringPaymentManager.addRecurringPayment +DA:179,160219 +DA:182,160219 +DA:185,160219 +DA:186,160219 +DA:187,160219 +DA:188,160219 +DA:190,160219 +DA:198,160219 FN:202,RecurringPaymentManager.removeRecurringPayment -FNDA:7759,RecurringPaymentManager.removeRecurringPayment -DA:207,7758 -DA:210,7758 -DA:213,7758 -DA:215,7758 +FNDA:8159,RecurringPaymentManager.removeRecurringPayment +DA:207,8158 +DA:210,8158 +DA:213,8158 +DA:215,8158 FN:222,RecurringPaymentManager.trigger -FNDA:3220,RecurringPaymentManager.trigger -DA:223,3220 +FNDA:3088,RecurringPaymentManager.trigger +DA:223,3088 FN:227,RecurringPaymentManager.triggerFor FNDA:1024,RecurringPaymentManager.triggerFor DA:234,256 FN:237,RecurringPaymentManager._triggerFor -FNDA:11234,RecurringPaymentManager._triggerFor -DA:239,11234 -DA:241,11234 -DA:244,11234 -DA:247,175032 -DA:248,163798 -DA:249,163798 -DA:257,11234 -DA:258,11234 -DA:261,11234 -DA:264,11234 -DA:267,11234 -DA:270,11234 -DA:273,175032 -DA:274,163798 -DA:277,163798 +FNDA:11502,RecurringPaymentManager._triggerFor +DA:239,11502 +DA:241,11502 +DA:244,11502 +DA:247,172555 +DA:248,161053 +DA:249,161053 +DA:257,11502 +DA:258,11502 +DA:261,11502 +DA:264,11502 +DA:267,11502 +DA:270,11502 +DA:273,172555 +DA:274,161053 +DA:277,161053 BRDA:277,1,0,- -BRDA:277,1,1,17238 -DA:278,27346 -DA:281,27346 +BRDA:277,1,1,16498 +DA:278,26732 +DA:281,26732 BRDA:281,2,0,- -BRDA:281,2,1,17238 -DA:282,27346 -DA:283,27346 +BRDA:281,2,1,16498 +DA:282,26732 +DA:283,26732 BRDA:283,3,0,- -BRDA:283,3,1,17238 -DA:284,17238 -DA:289,163798 -DA:291,163798 -DA:294,11234 -DA:297,11234 -DA:298,163798 -BRDA:298,4,0,27346 -BRDA:298,4,1,163798 -DA:299,163798 -BRDA:299,5,0,17238 -BRDA:299,5,1,163798 -DA:301,11234 -DA:303,11234 -DA:305,11234 -DA:308,11234 -DA:311,175032 -DA:313,163798 +BRDA:283,3,1,16498 +DA:284,16498 +DA:289,161053 +DA:291,161053 +DA:294,11502 +DA:297,11502 +DA:298,161053 +BRDA:298,4,0,26732 +BRDA:298,4,1,161053 +DA:299,161053 +BRDA:299,5,0,16498 +BRDA:299,5,1,161053 +DA:301,11502 +DA:303,11502 +DA:305,11502 +DA:308,11502 +DA:311,172555 +DA:313,161053 BRDA:313,6,0,- -BRDA:313,6,1,17238 -DA:315,27346 -DA:318,27346 -DA:325,27346 -DA:328,27346 +BRDA:313,6,1,16498 +DA:315,26732 +DA:318,26732 +DA:325,26732 +DA:328,26732 BRDA:328,7,0,- -BRDA:328,7,1,17238 -DA:330,17238 -DA:333,17238 -DA:342,17238 -DA:345,27346 -DA:349,163798 -DA:350,163798 -DA:353,11234 -DA:356,11234 -DA:360,11234 +BRDA:328,7,1,16498 +DA:330,16498 +DA:333,16498 +DA:342,16498 +DA:345,26732 +DA:349,161053 +DA:350,161053 +DA:353,11502 +DA:356,11502 +DA:360,11502 FN:365,RecurringPaymentManager._ensureTokenBalance -FNDA:14710,RecurringPaymentManager._ensureTokenBalance -DA:369,14710 -DA:371,14710 +FNDA:14846,RecurringPaymentManager._ensureTokenBalance +DA:369,14846 +DA:371,14846 BRDA:371,8,0,- -BRDA:371,8,1,7196 -DA:374,7196 -DA:375,7196 -DA:384,7196 +BRDA:371,8,1,7273 +DA:374,7273 +DA:375,7273 +DA:384,7273 BRDA:384,9,0,- -BRDA:384,9,1,7196 +BRDA:384,9,1,7273 DA:385,0 FN:390,RecurringPaymentManager._ensureTokenAllowance -FNDA:3476,RecurringPaymentManager._ensureTokenAllowance -DA:394,3476 -DA:395,3476 -DA:397,3476 -BRDA:397,10,0,2481 -BRDA:397,10,1,3476 -DA:398,2481 +FNDA:3344,RecurringPaymentManager._ensureTokenAllowance +DA:394,3344 +DA:395,3344 +DA:397,3344 +BRDA:397,10,0,2370 +BRDA:397,10,1,3344 +DA:398,2370 FN:402,RecurringPaymentManager._isAuthorizedPaymentProcessor -FNDA:3476,RecurringPaymentManager._isAuthorizedPaymentProcessor -DA:408,3476 +FNDA:3344,RecurringPaymentManager._isAuthorizedPaymentProcessor +DA:408,3344 FNF:17 FNH:14 LF:83 @@ -1381,256 +1359,256 @@ FN:85,StreamingPaymentProcessor.init FNDA:257,StreamingPaymentProcessor.init DA:90,256 FN:94,StreamingPaymentProcessor.claimAll -FNDA:52714,StreamingPaymentProcessor.claimAll -DA:96,52714 -BRDA:95,0,0,9532 -BRDA:95,0,1,43182 -DA:102,9532 -DA:107,43182 -FN:111,StreamingPaymentProcessor.claimForSpecificWalletId +FNDA:52521,StreamingPaymentProcessor.claimAll +DA:96,52521 +BRDA:95,0,0,9693 +BRDA:95,0,1,42828 +DA:101,9693 +DA:106,42828 +FN:110,StreamingPaymentProcessor.claimForSpecificWalletId FNDA:512,StreamingPaymentProcessor.claimForSpecificWalletId +DA:116,512 DA:117,512 -DA:118,512 -BRDA:116,1,0,- -BRDA:116,1,1,512 -DA:120,0 -DA:126,512 -BRDA:125,2,0,- -BRDA:125,2,1,512 -DA:129,0 -DA:134,512 -FN:140,StreamingPaymentProcessor.processPayments +BRDA:115,1,0,- +BRDA:115,1,1,512 +DA:119,0 +DA:125,512 +BRDA:124,2,0,- +BRDA:124,2,1,512 +DA:128,0 +DA:133,512 +FN:139,StreamingPaymentProcessor.processPayments FNDA:4356,StreamingPaymentProcessor.processPayments -DA:146,3844 -BRDA:146,3,0,- -BRDA:146,3,1,89254 +DA:145,3844 +BRDA:145,3,0,- +BRDA:145,3,1,90371 +DA:147,3588 DA:148,3588 DA:149,3588 -DA:150,3588 -DA:152,3588 -BRDA:152,4,0,- -BRDA:152,4,1,3588 -DA:153,0 +DA:151,3588 +BRDA:151,4,0,- +BRDA:151,4,1,3588 +DA:152,0 +DA:157,3588 DA:158,3588 DA:159,3588 DA:160,3588 DA:161,3588 -DA:162,3588 -DA:164,3588 -DA:166,3588 -DA:167,89254 -DA:168,89254 -DA:169,89254 -DA:170,89254 -DA:171,89254 -DA:173,89254 -DA:182,89254 -DA:192,89254 -FN:199,StreamingPaymentProcessor.cancelRunningPayments +DA:163,3588 +DA:165,3588 +DA:166,90371 +DA:167,90371 +DA:168,90371 +DA:169,90371 +DA:170,90371 +DA:172,90371 +DA:181,90371 +DA:191,90371 +FN:198,StreamingPaymentProcessor.cancelRunningPayments FNDA:1024,StreamingPaymentProcessor.cancelRunningPayments -DA:204,512 -FN:208,StreamingPaymentProcessor.removeAllPaymentReceiverPayments +DA:203,512 +FN:207,StreamingPaymentProcessor.removeAllPaymentReceiverPayments FNDA:0,StreamingPaymentProcessor.removeAllPaymentReceiverPayments -DA:213,0 -BRDA:212,5,0,- -BRDA:212,5,1,- -DA:216,0 -DA:220,0 -FN:224,StreamingPaymentProcessor.removePaymentForSpecificWalletId +DA:212,0 +BRDA:211,5,0,- +BRDA:211,5,1,- +DA:215,0 +DA:219,0 +FN:223,StreamingPaymentProcessor.removePaymentForSpecificWalletId FNDA:512,StreamingPaymentProcessor.removePaymentForSpecificWalletId -DA:231,512 -DA:241,512 -DA:242,512 -BRDA:240,6,0,512 -BRDA:240,6,1,512 -DA:246,512 -FN:254,StreamingPaymentProcessor.isActivePaymentReceiver -FNDA:19837,StreamingPaymentProcessor.isActivePaymentReceiver -DA:259,19837 -FN:263,StreamingPaymentProcessor.startForSpecificWalletId -FNDA:12175,StreamingPaymentProcessor.startForSpecificWalletId -DA:268,1064018 -FN:272,StreamingPaymentProcessor.dueToForSpecificWalletId -FNDA:12175,StreamingPaymentProcessor.dueToForSpecificWalletId -DA:277,1153174 -FN:281,StreamingPaymentProcessor.releasedForSpecificWalletId -FNDA:12175,StreamingPaymentProcessor.releasedForSpecificWalletId -DA:286,1041229 -FN:290,StreamingPaymentProcessor.vestedAmountForSpecificWalletId -FNDA:22789,StreamingPaymentProcessor.vestedAmountForSpecificWalletId -DA:296,1051843 -FN:302,StreamingPaymentProcessor.releasableForSpecificWalletId -FNDA:962117,StreamingPaymentProcessor.releasableForSpecificWalletId -DA:307,1029054 -DA:309,1029054 -FN:313,StreamingPaymentProcessor.unclaimable +DA:230,512 +DA:237,512 +DA:238,512 +BRDA:236,6,0,512 +BRDA:236,6,1,512 +DA:240,512 +FN:248,StreamingPaymentProcessor.isActivePaymentReceiver +FNDA:20957,StreamingPaymentProcessor.isActivePaymentReceiver +DA:253,20957 +FN:257,StreamingPaymentProcessor.startForSpecificWalletId +FNDA:13041,StreamingPaymentProcessor.startForSpecificWalletId +DA:262,1097618 +FN:266,StreamingPaymentProcessor.dueToForSpecificWalletId +FNDA:13041,StreamingPaymentProcessor.dueToForSpecificWalletId +DA:271,1188474 +FN:275,StreamingPaymentProcessor.releasedForSpecificWalletId +FNDA:13041,StreamingPaymentProcessor.releasedForSpecificWalletId +DA:280,1074490 +FN:284,StreamingPaymentProcessor.vestedAmountForSpecificWalletId +FNDA:23128,StreamingPaymentProcessor.vestedAmountForSpecificWalletId +DA:290,1084577 +FN:296,StreamingPaymentProcessor.releasableForSpecificWalletId +FNDA:993839,StreamingPaymentProcessor.releasableForSpecificWalletId +DA:301,1061449 +DA:303,1061449 +FN:307,StreamingPaymentProcessor.unclaimable FNDA:260,StreamingPaymentProcessor.unclaimable -DA:318,52976 -FN:322,StreamingPaymentProcessor.token +DA:312,52783 +FN:316,StreamingPaymentProcessor.token FNDA:1,StreamingPaymentProcessor.token -DA:323,70526 -FN:327,StreamingPaymentProcessor.viewAllPaymentOrders +DA:317,71199 +FN:321,StreamingPaymentProcessor.viewAllPaymentOrders FNDA:2560,StreamingPaymentProcessor.viewAllPaymentOrders +DA:327,2560 +DA:329,2560 +DA:331,2560 +DA:332,2560 DA:333,2560 -DA:335,2560 -DA:337,2560 -DA:338,2560 -DA:339,2560 -DA:341,7936 -DA:342,5376 -DA:346,5376 -DA:350,2560 -FN:360,StreamingPaymentProcessor._afterClaimCleanup -FNDA:66677,StreamingPaymentProcessor._afterClaimCleanup -DA:366,66677 -DA:369,66677 -DA:375,66677 -BRDA:375,7,0,64885 -BRDA:375,7,1,66677 -DA:376,64885 -DA:383,66677 -FN:392,StreamingPaymentProcessor._findAddressInActiveVestings -FNDA:154134,StreamingPaymentProcessor._findAddressInActiveVestings -DA:396,154134 -DA:398,154134 -DA:399,154134 -DA:400,3969115 -BRDA:400,8,0,67445 -BRDA:400,8,1,3901670 -DA:401,67445 -DA:404,3901670 -DA:407,86689 -FN:417,StreamingPaymentProcessor._findActiveWalletId -FNDA:67189,StreamingPaymentProcessor._findActiveWalletId -DA:422,67189 -DA:424,67189 -DA:426,67189 -DA:427,68213 -DA:428,68213 -BRDA:428,9,0,67189 -BRDA:428,9,1,1024 -DA:429,67189 -DA:432,1024 -DA:436,0 -FN:443,StreamingPaymentProcessor._cancelRunningOrders +DA:335,7936 +DA:336,5376 +DA:340,5376 +DA:344,2560 +FN:354,StreamingPaymentProcessor._afterClaimCleanup +FNDA:67350,StreamingPaymentProcessor._afterClaimCleanup +DA:360,67350 +DA:363,67350 +DA:369,67350 +BRDA:369,7,0,65558 +BRDA:369,7,1,67350 +DA:370,65558 +DA:377,67350 +FN:386,StreamingPaymentProcessor._findAddressInActiveVestings +FNDA:155924,StreamingPaymentProcessor._findAddressInActiveVestings +DA:390,155924 +DA:392,155924 +DA:393,155924 +DA:394,4053092 +BRDA:394,8,0,68118 +BRDA:394,8,1,3984974 +DA:395,68118 +DA:398,3984974 +DA:401,87806 +FN:411,StreamingPaymentProcessor._findActiveWalletId +FNDA:67862,StreamingPaymentProcessor._findActiveWalletId +DA:416,67862 +DA:418,67862 +DA:420,67862 +DA:421,68886 +DA:422,68886 +BRDA:422,9,0,67862 +BRDA:422,9,1,1024 +DA:423,67862 +DA:426,1024 +DA:430,0 +FN:437,StreamingPaymentProcessor._cancelRunningOrders FNDA:512,StreamingPaymentProcessor._cancelRunningOrders -DA:444,512 -DA:445,512 -DA:447,512 -DA:448,22219 -DA:449,21707 -DA:452,21707 -FN:463,StreamingPaymentProcessor._removePayment -FNDA:21707,StreamingPaymentProcessor._removePayment -DA:464,21707 -DA:466,21707 -DA:468,21707 -DA:469,21707 -DA:470,43414 -DA:471,21707 -DA:472,21707 -DA:477,21707 -DA:478,21707 -BRDA:476,10,0,15976 -BRDA:476,10,1,21707 -DA:480,15976 -DA:484,21707 -FN:495,StreamingPaymentProcessor._removePaymentForSpecificWalletId -FNDA:66677,StreamingPaymentProcessor._removePaymentForSpecificWalletId -DA:500,66677 -DA:501,66677 -DA:503,66677 -BRDA:503,11,0,- -BRDA:503,11,1,66677 -DA:504,0 -DA:512,66677 -DA:516,66677 -FN:525,StreamingPaymentProcessor._removeVestingInformationForSpecificWalletId -FNDA:66677,StreamingPaymentProcessor._removeVestingInformationForSpecificWalletId -DA:530,66677 -FN:538,StreamingPaymentProcessor._removePaymentReceiverFromActiveVestings -FNDA:64885,StreamingPaymentProcessor._removePaymentReceiverFromActiveVestings -DA:543,64885 -DA:544,64885 -DA:546,64885 -BRDA:546,12,0,- -BRDA:546,12,1,64885 -DA:547,0 -DA:553,64885 -DA:554,64885 -DA:558,64885 -FN:570,StreamingPaymentProcessor._addPayment -FNDA:89254,StreamingPaymentProcessor._addPayment -DA:579,89254 -DA:580,89249 -BRDA:578,13,0,5 -BRDA:578,13,1,89249 -DA:582,5 -DA:586,89249 -DA:588,89249 -DA:594,89249 -BRDA:593,14,0,86689 -BRDA:593,14,1,89249 -DA:597,86689 -DA:600,89249 -DA:602,89249 -FN:615,StreamingPaymentProcessor._claimAll -FNDA:43182,StreamingPaymentProcessor._claimAll -DA:616,43182 -DA:618,43182 -DA:620,43182 -DA:621,87388 -DA:622,44206 -DA:627,44206 -FN:640,StreamingPaymentProcessor._claimForSpecificWalletId -FNDA:66937,StreamingPaymentProcessor._claimForSpecificWalletId -DA:646,66937 -DA:647,66937 -DA:648,66937 -DA:651,66937 -DA:652,65913 -BRDA:650,15,0,2 -BRDA:650,15,1,66937 -DA:654,2 -DA:655,2 -DA:658,66937 -DA:660,66937 -DA:669,66937 -BRDA:669,16,0,66935 -BRDA:669,16,1,2 -DA:670,66935 -DA:672,2 -DA:675,66937 -DA:676,66937 -DA:679,66937 -BRDA:679,17,0,50189 -BRDA:679,17,1,66937 -DA:680,50189 -FN:690,StreamingPaymentProcessor._vestingAmountForSpecificWalletId -FNDA:1051843,StreamingPaymentProcessor._vestingAmountForSpecificWalletId -DA:696,1051843 -DA:698,1051843 -DA:699,1051843 -DA:700,1051843 -DA:701,1051843 -DA:703,1051843 -BRDA:703,18,0,- -BRDA:703,18,1,1051843 -DA:704,0 -DA:705,1051843 -BRDA:705,19,0,123854 -BRDA:705,19,1,927989 -DA:706,123854 -DA:708,927989 -FN:716,StreamingPaymentProcessor.validAddress -FNDA:89254,StreamingPaymentProcessor.validAddress -DA:717,89254 -FN:726,StreamingPaymentProcessor.validSalary -FNDA:89250,StreamingPaymentProcessor.validSalary -DA:727,89250 -FN:733,StreamingPaymentProcessor.validStart -FNDA:89249,StreamingPaymentProcessor.validStart -DA:734,89249 +DA:438,512 +DA:439,512 +DA:441,512 +DA:442,23246 +DA:443,22734 +DA:446,22734 +FN:457,StreamingPaymentProcessor._removePayment +FNDA:22734,StreamingPaymentProcessor._removePayment +DA:458,22734 +DA:460,22734 +DA:462,22734 +DA:463,22734 +DA:464,45468 +DA:465,22734 +DA:466,22734 +DA:471,22734 +DA:472,22734 +BRDA:470,10,0,16949 +BRDA:470,10,1,22734 +DA:474,16949 +DA:478,22734 +FN:489,StreamingPaymentProcessor._removePaymentForSpecificWalletId +FNDA:67350,StreamingPaymentProcessor._removePaymentForSpecificWalletId +DA:494,67350 +DA:495,67350 +DA:497,67350 +BRDA:497,11,0,- +BRDA:497,11,1,67350 +DA:498,0 +DA:506,67350 +DA:510,67350 +FN:519,StreamingPaymentProcessor._removeVestingInformationForSpecificWalletId +FNDA:67350,StreamingPaymentProcessor._removeVestingInformationForSpecificWalletId +DA:524,67350 +FN:532,StreamingPaymentProcessor._removePaymentReceiverFromActiveVestings +FNDA:65558,StreamingPaymentProcessor._removePaymentReceiverFromActiveVestings +DA:537,65558 +DA:538,65558 +DA:540,65558 +BRDA:540,12,0,- +BRDA:540,12,1,65558 +DA:541,0 +DA:547,65558 +DA:548,65558 +DA:552,65558 +FN:564,StreamingPaymentProcessor._addPayment +FNDA:90371,StreamingPaymentProcessor._addPayment +DA:573,90371 +DA:574,90366 +BRDA:572,13,0,5 +BRDA:572,13,1,90366 +DA:576,5 +DA:580,90366 +DA:582,90366 +DA:588,90366 +BRDA:587,14,0,87806 +BRDA:587,14,1,90366 +DA:591,87806 +DA:594,90366 +DA:596,90366 +FN:609,StreamingPaymentProcessor._claimAll +FNDA:42828,StreamingPaymentProcessor._claimAll +DA:610,42828 +DA:612,42828 +DA:614,42828 +DA:615,86680 +DA:616,43852 +DA:621,43852 +FN:634,StreamingPaymentProcessor._claimForSpecificWalletId +FNDA:67610,StreamingPaymentProcessor._claimForSpecificWalletId +DA:640,67610 +DA:641,67610 +DA:642,67610 +DA:645,67610 +DA:646,66586 +BRDA:644,15,0,2 +BRDA:644,15,1,67610 +DA:648,2 +DA:649,2 +DA:652,67610 +DA:654,67610 +DA:663,67610 +BRDA:663,16,0,67608 +BRDA:663,16,1,2 +DA:664,67608 +DA:666,2 +DA:669,67610 +DA:670,67610 +DA:673,67610 +BRDA:673,17,0,49889 +BRDA:673,17,1,67610 +DA:674,49889 +FN:684,StreamingPaymentProcessor._vestingAmountForSpecificWalletId +FNDA:1084577,StreamingPaymentProcessor._vestingAmountForSpecificWalletId +DA:690,1084577 +DA:692,1084577 +DA:693,1084577 +DA:694,1084577 +DA:695,1084577 +DA:697,1084577 +BRDA:697,18,0,- +BRDA:697,18,1,1084577 +DA:698,0 +DA:699,1084577 +BRDA:699,19,0,125431 +BRDA:699,19,1,959146 +DA:700,125431 +DA:702,959146 +FN:710,StreamingPaymentProcessor.validAddress +FNDA:90371,StreamingPaymentProcessor.validAddress +DA:711,90371 +FN:720,StreamingPaymentProcessor.validSalary +FNDA:90367,StreamingPaymentProcessor.validSalary +DA:721,90367 +FN:727,StreamingPaymentProcessor.validStart +FNDA:90366,StreamingPaymentProcessor.validStart +DA:728,90366 FNF:31 FNH:30 LF:152 @@ -1713,29 +1691,29 @@ BRDA:106,2,1,516 DA:110,0 DA:114,516 DA:115,516 -DA:116,7008 -DA:119,7008 -DA:120,7006 +DA:116,7491 +DA:119,7491 +DA:120,7489 BRDA:118,3,0,3 -BRDA:118,3,1,7005 +BRDA:118,3,1,7488 DA:122,3 -DA:125,7005 +DA:125,7488 BRDA:125,4,0,256 -BRDA:125,4,1,6749 +BRDA:125,4,1,7232 DA:126,256 -DA:129,6749 -DA:130,6749 +DA:129,7232 +DA:130,7232 DA:134,257 DA:137,257 DA:138,257 DA:141,257 DA:142,257 FN:148,SingleVoteGovernor.getReceipt -FNDA:41795,SingleVoteGovernor.getReceipt -DA:153,41795 -DA:155,41795 +FNDA:44107,SingleVoteGovernor.getReceipt +DA:153,44107 +DA:155,44107 FN:161,SingleVoteGovernor.setThreshold -FNDA:5048,SingleVoteGovernor.setThreshold +FNDA:4850,SingleVoteGovernor.setThreshold DA:163,259 BRDA:163,5,0,256 BRDA:163,5,1,3 @@ -1743,7 +1721,7 @@ DA:164,256 DA:170,3 DA:171,3 FN:174,SingleVoteGovernor.setVotingDuration -FNDA:4990,SingleVoteGovernor.setVotingDuration +FNDA:4711,SingleVoteGovernor.setVotingDuration DA:177,6 DA:178,5 BRDA:176,6,0,2 @@ -1752,99 +1730,99 @@ DA:180,2 DA:183,4 DA:184,4 FN:190,SingleVoteGovernor.addVoter -FNDA:61738,SingleVoteGovernor.addVoter -DA:191,56950 -BRDA:191,7,0,51870 -BRDA:191,7,1,56950 -DA:192,51870 -DA:194,51870 -DA:196,51870 +FNDA:62809,SingleVoteGovernor.addVoter +DA:191,58056 +BRDA:191,7,0,52962 +BRDA:191,7,1,58056 +DA:192,52962 +DA:194,52962 +DA:196,52962 FN:200,SingleVoteGovernor.removeVoter -FNDA:13645,SingleVoteGovernor.removeVoter -DA:202,9145 +FNDA:14512,SingleVoteGovernor.removeVoter +DA:202,9767 BRDA:202,8,0,1 -BRDA:202,8,1,9144 +BRDA:202,8,1,9766 DA:203,1 -DA:207,9144 +DA:207,9766 BRDA:207,9,0,1 -BRDA:207,9,1,9143 +BRDA:207,9,1,9765 DA:208,1 -DA:211,9143 -BRDA:211,10,0,4573 -BRDA:211,10,1,9143 -DA:212,4573 -DA:214,4573 -DA:216,4573 +DA:211,9765 +BRDA:211,10,0,4884 +BRDA:211,10,1,9765 +DA:212,4884 +DA:214,4884 +DA:216,4884 FN:223,SingleVoteGovernor.createMotion -FNDA:58888,SingleVoteGovernor.createMotion -DA:229,53904 -DA:233,53904 -DA:236,53904 -DA:237,53904 -DA:239,53904 -DA:240,53904 -DA:241,53904 -DA:243,53904 -DA:247,53904 -DA:250,53904 +FNDA:60141,SingleVoteGovernor.createMotion +DA:229,55150 +DA:233,55150 +DA:236,55150 +DA:237,55150 +DA:239,55150 +DA:240,55150 +DA:241,55150 +DA:243,55150 +DA:247,55150 +DA:250,55150 FN:253,SingleVoteGovernor.castVote -FNDA:357412,SingleVoteGovernor.castVote -DA:258,342369 +FNDA:359865,SingleVoteGovernor.castVote +DA:258,344948 BRDA:258,11,0,256 -BRDA:258,11,1,342113 +BRDA:258,11,1,344692 DA:259,256 -DA:263,342113 -BRDA:263,12,0,68124 -BRDA:263,12,1,273989 -DA:264,68124 -DA:268,273989 -DA:271,273989 -BRDA:271,13,0,94377 -BRDA:271,13,1,179612 -DA:272,94377 -DA:276,179612 -BRDA:276,14,0,14529 -BRDA:276,14,1,165083 -DA:277,14529 -DA:280,165083 -BRDA:280,15,0,150149 -BRDA:280,15,1,14934 -DA:282,150149 -DA:284,14934 -BRDA:284,16,0,9844 -BRDA:284,16,1,5090 -DA:286,9844 -DA:288,5090 -BRDA:288,17,0,5090 -BRDA:288,17,1,5090 -DA:290,5090 -DA:294,165083 +DA:263,344692 +BRDA:263,12,0,66282 +BRDA:263,12,1,278410 +DA:264,66282 +DA:268,278410 +DA:271,278410 +BRDA:271,13,0,95130 +BRDA:271,13,1,183280 +DA:272,95130 +DA:276,183280 +BRDA:276,14,0,13929 +BRDA:276,14,1,169351 +DA:277,13929 +DA:280,169351 +BRDA:280,15,0,154182 +BRDA:280,15,1,15169 +DA:282,154182 +DA:284,15169 +BRDA:284,16,0,10067 +BRDA:284,16,1,5102 +DA:286,10067 +DA:288,5102 +BRDA:288,17,0,5102 +BRDA:288,17,1,5102 +DA:290,5102 +DA:294,169351 FN:297,SingleVoteGovernor.executeMotion -FNDA:47055,SingleVoteGovernor.executeMotion -DA:299,47055 -DA:302,47055 +FNDA:48133,SingleVoteGovernor.executeMotion +DA:299,48133 +DA:302,48133 BRDA:302,18,0,256 -BRDA:302,18,1,46799 +BRDA:302,18,1,47877 DA:303,256 -DA:307,46799 +DA:307,47877 BRDA:307,19,0,2 -BRDA:307,19,1,46797 +BRDA:307,19,1,47875 DA:308,2 -DA:312,46797 +DA:312,47875 BRDA:312,20,0,1 -BRDA:312,20,1,46796 +BRDA:312,20,1,47874 DA:313,1 -DA:317,46796 +DA:317,47874 BRDA:317,21,0,1 -BRDA:317,21,1,46795 +BRDA:317,21,1,47873 DA:318,1 -DA:322,46795 -DA:325,46795 -DA:326,46795 -DA:327,46795 -DA:330,46795 -DA:331,46795 -DA:333,46795 +DA:322,47873 +DA:325,47873 +DA:326,47873 +DA:327,47873 +DA:330,47873 +DA:331,47873 +DA:333,47873 FNF:9 FNH:9 LF:93 @@ -1854,100 +1832,100 @@ BRH:42 end_of_record TN: SF:src/orchestrator/Orchestrator.sol -FN:94,Orchestrator.init -FNDA:15533,Orchestrator.init -DA:103,15277 -DA:106,15277 -DA:108,15277 -DA:110,15277 -DA:111,15277 -DA:112,15277 -DA:117,15277 -DA:118,15277 -DA:119,15277 -FN:130,Orchestrator._isModuleUsedInOrchestrator +FN:98,Orchestrator.init +FNDA:15584,Orchestrator.init +DA:107,15328 +DA:110,15328 +DA:112,15328 +DA:114,15328 +DA:115,15328 +DA:116,15328 +DA:121,15328 +DA:122,15328 +DA:123,15328 +FN:134,Orchestrator._isModuleUsedInOrchestrator FNDA:0,Orchestrator._isModuleUsedInOrchestrator -DA:135,0 -DA:136,0 -DA:137,0 -DA:138,0 +DA:139,0 DA:140,0 DA:141,0 -DA:143,0 -BRDA:143,0,0,- -BRDA:143,0,1,- +DA:142,0 +DA:144,0 DA:145,0 -DA:146,0 -BRDA:144,1,0,- -BRDA:144,1,1,- -DA:148,0 -DA:153,0 +DA:147,0 +BRDA:147,0,0,- +BRDA:147,0,1,- +DA:149,0 +DA:150,0 +BRDA:148,1,0,- +BRDA:148,1,1,- +DA:152,0 DA:157,0 -FN:161,Orchestrator.findModuleAddressInOrchestrator +DA:161,0 +FN:165,Orchestrator.findModuleAddressInOrchestrator FNDA:0,Orchestrator.findModuleAddressInOrchestrator -DA:166,0 -DA:167,0 -DA:168,0 -BRDA:168,2,0,- -BRDA:168,2,1,- -DA:169,0 +DA:170,0 +DA:171,0 DA:172,0 -FN:182,Orchestrator.verifyAddressIsAuthorizerModule +BRDA:172,2,0,- +BRDA:172,2,1,- +DA:173,0 +DA:176,0 +FN:186,Orchestrator.verifyAddressIsAuthorizerModule FNDA:0,Orchestrator.verifyAddressIsAuthorizerModule -DA:187,0 -DA:189,0 -FN:198,Orchestrator.verifyAddressIsFundingManager +DA:191,0 +DA:193,0 +FN:201,Orchestrator.verifyAddressIsFundingManager FNDA:0,Orchestrator.verifyAddressIsFundingManager -DA:203,0 -DA:204,0 DA:206,0 -FN:214,Orchestrator.verifyAddressIsRecurringPaymentManager +DA:207,0 +DA:209,0 +FN:217,Orchestrator.verifyAddressIsRecurringPaymentManager FNDA:0,Orchestrator.verifyAddressIsRecurringPaymentManager -DA:217,0 -DA:218,0 DA:220,0 -FN:228,Orchestrator.verifyAddressIsPaymentProcessor +DA:221,0 +DA:223,0 +FN:231,Orchestrator.verifyAddressIsPaymentProcessor FNDA:0,Orchestrator.verifyAddressIsPaymentProcessor -DA:233,0 -DA:234,0 DA:236,0 -FN:248,Orchestrator.__ModuleManager_isAuthorized -FNDA:1586,Orchestrator.__ModuleManager_isAuthorized -DA:254,1586 -FN:261,Orchestrator.setAuthorizer +DA:237,0 +DA:239,0 +FN:251,Orchestrator.__ModuleManager_isAuthorized +FNDA:1572,Orchestrator.__ModuleManager_isAuthorized +DA:257,1572 +FN:264,Orchestrator.setAuthorizer FNDA:257,Orchestrator.setAuthorizer -DA:265,257 -DA:266,257 -DA:267,257 DA:268,257 -FN:272,Orchestrator.setFundingManager +DA:269,257 +DA:270,257 +DA:271,257 +FN:275,Orchestrator.setFundingManager FNDA:257,Orchestrator.setFundingManager -DA:276,257 -DA:277,257 -DA:278,257 DA:279,257 -FN:283,Orchestrator.setPaymentProcessor +DA:280,257 +DA:281,257 +DA:282,257 +FN:286,Orchestrator.setPaymentProcessor FNDA:257,Orchestrator.setPaymentProcessor -DA:287,257 -DA:288,257 -DA:289,257 DA:290,257 -FN:294,Orchestrator.executeTx +DA:291,257 +DA:292,257 +DA:293,257 +FN:297,Orchestrator.executeTx FNDA:1024,Orchestrator.executeTx -DA:299,512 -DA:300,512 -DA:301,512 +DA:302,512 DA:303,512 -BRDA:303,3,0,256 -BRDA:303,3,1,256 -DA:304,256 -DA:306,256 -FN:314,Orchestrator.token -FNDA:178343,Orchestrator.token -DA:315,178343 -FN:319,Orchestrator.version +DA:304,512 +DA:306,512 +BRDA:306,3,0,256 +BRDA:306,3,1,256 +DA:307,256 +DA:309,256 +FN:317,Orchestrator.token +FNDA:182734,Orchestrator.token +DA:318,182734 +FN:322,Orchestrator.version FNDA:1,Orchestrator.version -DA:320,1 +DA:323,1 FNF:14 FNH:8 LF:58 @@ -1958,72 +1936,72 @@ end_of_record TN: SF:src/orchestrator/base/ModuleManager.sol FN:101,ModuleManager.__ModuleManager_init -FNDA:15794,ModuleManager.__ModuleManager_init -DA:105,15793 -DA:107,15793 -DA:108,15793 -DA:112,15793 -BRDA:112,0,0,258 -BRDA:112,0,1,15535 -DA:113,258 -DA:116,15535 -DA:117,169516 -DA:119,169516 +FNDA:15845,ModuleManager.__ModuleManager_init +DA:105,15844 +DA:107,15844 +DA:108,15844 +DA:112,15844 +BRDA:112,0,0,261 +BRDA:112,0,1,15583 +DA:113,261 +DA:116,15583 +DA:117,168728 +DA:119,168728 FN:123,ModuleManager.__ModuleManager_addModule -FNDA:215347,ModuleManager.__ModuleManager_addModule -DA:128,215343 +FNDA:214712,ModuleManager.__ModuleManager_addModule +DA:128,214708 FN:147,ModuleManager.isModule -FNDA:97398,ModuleManager.isModule -DA:153,437978 +FNDA:100057,ModuleManager.isModule +DA:153,444071 FN:157,ModuleManager.listModules -FNDA:1280,ModuleManager.listModules -DA:158,1280 +FNDA:1277,ModuleManager.listModules +DA:158,1277 FN:162,ModuleManager.modulesSize FNDA:0,ModuleManager.modulesSize DA:163,0 FN:170,ModuleManager.addModule -FNDA:76421,ModuleManager.addModule -DA:177,76421 +FNDA:78704,ModuleManager.addModule +DA:177,78704 FN:181,ModuleManager.removeModule -FNDA:28677,ModuleManager.removeModule -DA:186,28936 +FNDA:30201,ModuleManager.removeModule +DA:186,30460 FN:193,ModuleManager.executeTxFromModule -FNDA:19361,ModuleManager.executeTxFromModule -DA:199,19360 -DA:200,19360 -DA:202,19360 -DA:204,19360 +FNDA:19623,ModuleManager.executeTxFromModule +DA:199,19622 +DA:200,19622 +DA:202,19622 +DA:204,19622 FN:212,ModuleManager._commitAddModule -FNDA:291764,ModuleManager._commitAddModule -DA:214,291764 -DA:215,291764 -DA:216,291764 +FNDA:293412,ModuleManager._commitAddModule +DA:214,293412 +DA:215,293412 +DA:216,293412 FN:221,ModuleManager._commitRemoveModule -FNDA:28936,ModuleManager._commitRemoveModule -DA:228,28936 -DA:230,28936 -DA:232,28936 -DA:233,28936 -DA:234,870267 -BRDA:234,1,0,28936 -BRDA:234,1,1,841331 -DA:235,28936 -DA:236,28936 -DA:241,28936 -DA:243,28936 -DA:245,28936 -DA:247,28936 +FNDA:30460,ModuleManager._commitRemoveModule +DA:228,30460 +DA:230,30460 +DA:232,30460 +DA:233,30460 +DA:234,956415 +BRDA:234,1,0,30460 +BRDA:234,1,1,925955 +DA:235,30460 +DA:236,30460 +DA:241,30460 +DA:243,30460 +DA:245,30460 +DA:247,30460 FN:250,ModuleManager._ensureValidModule -FNDA:291770,ModuleManager._ensureValidModule -DA:251,291770 +FNDA:293418,ModuleManager._ensureValidModule +DA:251,293418 BRDA:251,2,0,6 -BRDA:251,2,1,291764 +BRDA:251,2,1,293412 DA:252,6 FN:256,ModuleManager._ensureNotModule -FNDA:292027,ModuleManager._ensureNotModule -DA:257,292027 +FNDA:293675,ModuleManager._ensureNotModule +DA:257,293675 BRDA:257,3,0,257 -BRDA:257,3,1,291770 +BRDA:257,3,1,293418 DA:258,257 FNF:12 FNH:11 @@ -2235,10 +2213,10 @@ DA:34,6538 FN:37,ElasticReceiptTokenBaseMock.mint FNDA:3338,ElasticReceiptTokenBaseMock.mint DA:38,3338 -DA:39,2957 +DA:39,2958 FN:42,ElasticReceiptTokenBaseMock.burn -FNDA:158,ElasticReceiptTokenBaseMock.burn -DA:43,158 +FNDA:160,ElasticReceiptTokenBaseMock.burn +DA:43,160 DA:44,0 FNF:3 FNH:3 @@ -2296,7 +2274,7 @@ SF:test/orchestrator/helper/TypeSanityHelper.sol FN:16,TypeSanityHelper.assumeElemNotInSet FNDA:8960,TypeSanityHelper.assumeElemNotInSet DA:20,8960 -DA:21,608288 +DA:21,602685 FN:29,TypeSanityHelper.assumeValidOrchestratorId FNDA:2048,TypeSanityHelper.assumeValidOrchestratorId DA:30,2048 @@ -2304,20 +2282,20 @@ FN:41,TypeSanityHelper.assumeValidModules FNDA:3072,TypeSanityHelper.assumeValidModules DA:42,3072 DA:43,3072 -DA:44,218341 -DA:47,218341 -DA:50,218341 +DA:44,219521 +DA:47,219521 +DA:50,219521 FN:54,TypeSanityHelper.assumeValidModule FNDA:1024,TypeSanityHelper.assumeValidModule -DA:55,219365 -DA:57,219365 -DA:58,658095 +DA:55,220545 +DA:57,220545 +DA:58,661635 FN:62,TypeSanityHelper.createInvalidModules FNDA:2,TypeSanityHelper.createInvalidModules -DA:63,219367 -DA:65,219367 -DA:66,219367 -DA:68,219367 +DA:63,220547 +DA:65,220547 +DA:66,220547 +DA:68,220547 FN:75,TypeSanityHelper.assumeValidFunders FNDA:0,TypeSanityHelper.assumeValidFunders FNF:6 @@ -2330,11 +2308,11 @@ end_of_record TN: SF:test/utils/mocks/ERC20Mock.sol FN:14,ERC20Mock.mint -FNDA:127506,ERC20Mock.mint -DA:15,127506 +FNDA:127864,ERC20Mock.mint +DA:15,127864 FN:18,ERC20Mock.burn -FNDA:25375,ERC20Mock.burn -DA:19,25375 +FNDA:24789,ERC20Mock.burn +DA:19,24789 FN:22,ERC20Mock.blockAddress FNDA:1,ERC20Mock.blockAddress DA:23,1 @@ -2346,32 +2324,32 @@ FNDA:2,ERC20Mock.toggleReturnFalse DA:31,2 FN:34,ERC20Mock.isBlockedAddress FNDA:2,ERC20Mock.isBlockedAddress -DA:35,113832 +DA:35,116359 FN:38,ERC20Mock.transfer -FNDA:26191,ERC20Mock.transfer -DA:39,26191 +FNDA:27699,ERC20Mock.transfer +DA:39,27699 BRDA:39,0,0,- -BRDA:39,0,1,26191 +BRDA:39,0,1,27699 DA:40,0 -DA:42,26191 +DA:42,27699 BRDA:42,1,0,- -BRDA:42,1,1,26191 -DA:43,26191 -DA:44,26191 -DA:45,26191 +BRDA:42,1,1,27699 +DA:43,27699 +DA:44,27699 +DA:45,27699 FN:48,ERC20Mock.transferFrom -FNDA:87640,ERC20Mock.transferFrom -DA:53,87640 +FNDA:88659,ERC20Mock.transferFrom +DA:53,88659 BRDA:53,2,0,1 -BRDA:53,2,1,87639 +BRDA:53,2,1,88658 DA:54,1 -DA:56,87639 +DA:56,88658 BRDA:56,3,0,1 -BRDA:56,3,1,87638 -DA:57,87638 -DA:58,87638 -DA:59,87638 -DA:60,87638 +BRDA:56,3,1,88657 +DA:57,88657 +DA:58,88657 +DA:59,88657 +DA:60,88657 FNF:8 FNH:8 LF:19 @@ -2382,12 +2360,12 @@ end_of_record TN: SF:test/utils/mocks/ERC721Mock.sol FN:15,ERC721Mock.mint -FNDA:1888,ERC721Mock.mint -DA:16,1888 -DA:17,1888 +FNDA:1879,ERC721Mock.mint +DA:16,1879 +DA:17,1879 FN:20,ERC721Mock.burn -FNDA:2144,ERC721Mock.burn -DA:21,2144 +FNDA:2135,ERC721Mock.burn +DA:21,2135 FN:24,ERC721Mock.blockAddress FNDA:0,ERC721Mock.blockAddress DA:25,0 @@ -2413,8 +2391,8 @@ end_of_record TN: SF:test/utils/mocks/factories/ModuleFactoryMock.sol FN:20,ModuleFactoryMock.createModule -FNDA:51084,ModuleFactoryMock.createModule -DA:24,51084 +FNDA:51183,ModuleFactoryMock.createModule +DA:24,51183 FN:27,ModuleFactoryMock.getBeaconAndId FNDA:0,ModuleFactoryMock.getBeaconAndId DA:32,0 @@ -2486,77 +2464,76 @@ BRDA:36,0,0,- BRDA:36,0,1,257 DA:38,257 DA:40,257 -DA:42,257 -FN:46,AuthorizerMock.mockInit +DA:41,257 +FN:44,AuthorizerMock.mockInit FNDA:256,AuthorizerMock.mockInit -DA:48,256 +DA:46,256 +DA:47,256 +BRDA:47,1,0,- +BRDA:47,1,1,256 DA:49,256 -BRDA:49,1,0,- -BRDA:49,1,1,256 -DA:51,256 -FN:58,AuthorizerMock.isAuthorized -FNDA:3844,AuthorizerMock.isAuthorized -DA:59,3844 -FN:65,AuthorizerMock.isAuthorized -FNDA:0,AuthorizerMock.isAuthorized -DA:70,0 -FN:77,AuthorizerMock.generateRoleId -FNDA:285777,AuthorizerMock.generateRoleId -DA:82,623465 -FN:85,AuthorizerMock.grantRoleFromModule +FN:75,AuthorizerMock.generateRoleId +FNDA:294941,AuthorizerMock.generateRoleId +DA:80,295709 +FN:83,AuthorizerMock.grantRoleFromModule FNDA:512,AuthorizerMock.grantRoleFromModule -DA:86,512 -DA:87,512 -FN:90,AuthorizerMock.revokeRoleFromModule +DA:84,512 +DA:85,512 +FN:88,AuthorizerMock.revokeRoleFromModule FNDA:256,AuthorizerMock.revokeRoleFromModule -DA:91,256 -FN:94,AuthorizerMock.toggleModuleSelfManagement -FNDA:513,AuthorizerMock.toggleModuleSelfManagement -FN:96,AuthorizerMock.transferAdminRole +DA:89,256 +FN:92,AuthorizerMock.toggleModuleSelfManagement +FNDA:0,AuthorizerMock.toggleModuleSelfManagement +FN:94,AuthorizerMock.transferAdminRole FNDA:0,AuthorizerMock.transferAdminRole -FN:98,AuthorizerMock.burnAdminRole -FNDA:0,AuthorizerMock.burnAdminRole -FN:102,AuthorizerMock.getRoleAdmin +FN:96,AuthorizerMock.burnAdminFromModuleRole +FNDA:0,AuthorizerMock.burnAdminFromModuleRole +FN:100,AuthorizerMock.getRoleAdmin FNDA:0,AuthorizerMock.getRoleAdmin -DA:103,0 -FN:106,AuthorizerMock.getRoleMember +DA:101,0 +FN:104,AuthorizerMock.getRoleMember FNDA:0,AuthorizerMock.getRoleMember -DA:107,0 -FN:110,AuthorizerMock.getRoleMemberCount +DA:105,0 +FN:108,AuthorizerMock.getRoleMemberCount FNDA:0,AuthorizerMock.getRoleMemberCount -DA:111,0 -FN:114,AuthorizerMock.grantRole +DA:109,0 +FN:112,AuthorizerMock.grantRole FNDA:0,AuthorizerMock.grantRole -DA:115,0 -FN:118,AuthorizerMock.hasRole -FNDA:620885,AuthorizerMock.hasRole -DA:119,620885 -FN:122,AuthorizerMock.checkRoleMembership +DA:113,0 +FN:116,AuthorizerMock.hasRole +FNDA:636379,AuthorizerMock.hasRole +DA:117,636379 +FN:120,AuthorizerMock.hasModuleRole +FNDA:0,AuthorizerMock.hasModuleRole +DA:125,0 +DA:126,0 +DA:127,0 +FN:130,AuthorizerMock.checkRoleMembership FNDA:512,AuthorizerMock.checkRoleMembership -DA:127,512 -FN:130,AuthorizerMock.revokeRole +DA:135,512 +FN:138,AuthorizerMock.revokeRole FNDA:0,AuthorizerMock.revokeRole -DA:131,0 -FN:134,AuthorizerMock.renounceRole +DA:139,0 +FN:142,AuthorizerMock.renounceRole FNDA:0,AuthorizerMock.renounceRole -FN:136,AuthorizerMock.getOwnerRole -FNDA:168456,AuthorizerMock.getOwnerRole -DA:137,168456 -FN:140,AuthorizerMock.getManagerRole -FNDA:167178,AuthorizerMock.getManagerRole -DA:141,167178 -FN:148,AuthorizerMock.grantGlobalRole +FN:144,AuthorizerMock.getOwnerRole +FNDA:173795,AuthorizerMock.getOwnerRole +DA:145,173795 +FN:148,AuthorizerMock.getManagerRole +FNDA:168421,AuthorizerMock.getManagerRole +DA:149,168421 +FN:156,AuthorizerMock.grantGlobalRole FNDA:0,AuthorizerMock.grantGlobalRole -DA:149,0 -DA:150,0 -FN:157,AuthorizerMock.revokeGlobalRole -FNDA:0,AuthorizerMock.revokeGlobalRole +DA:157,0 DA:158,0 -DA:159,0 -FNF:24 -FNH:12 -LF:30 -LH:19 +FN:165,AuthorizerMock.revokeGlobalRole +FNDA:0,AuthorizerMock.revokeGlobalRole +DA:166,0 +DA:167,0 +FNF:23 +FNH:10 +LF:31 +LH:18 BRF:4 BRH:2 end_of_record @@ -2584,8 +2561,8 @@ FN:47,FundingManagerMock.withdrawTo FNDA:0,FundingManagerMock.withdrawTo DA:48,0 FN:51,FundingManagerMock.transferOrchestratorToken -FNDA:19100,FundingManagerMock.transferOrchestratorToken -DA:52,19100 +FNDA:19362,FundingManagerMock.transferOrchestratorToken +DA:52,19362 FNF:8 FNH:3 LF:8 @@ -2596,15 +2573,15 @@ end_of_record TN: SF:test/utils/mocks/modules/PaymentProcessorMock.sol FN:15,PaymentProcessorMock.processPayments -FNDA:11646,PaymentProcessorMock.processPayments +FNDA:11912,PaymentProcessorMock.processPayments FN:17,PaymentProcessorMock.cancelRunningPayments FNDA:0,PaymentProcessorMock.cancelRunningPayments FN:19,PaymentProcessorMock.token FNDA:0,PaymentProcessorMock.token DA:20,0 FN:23,PaymentProcessorMock.deleteAllPayments -FNDA:3220,PaymentProcessorMock.deleteAllPayments -DA:24,3220 +FNDA:3088,PaymentProcessorMock.deleteAllPayments +DA:24,3088 FNF:4 FNH:2 LF:2 @@ -2633,8 +2610,8 @@ FN:29,ERC20PaymentClientMock.setIsAuthorized FNDA:1,ERC20PaymentClientMock.setIsAuthorized DA:30,1 FN:36,ERC20PaymentClientMock.addPaymentOrder -FNDA:87972,ERC20PaymentClientMock.addPaymentOrder -DA:37,87972 +FNDA:89089,ERC20PaymentClientMock.addPaymentOrder +DA:37,89089 FN:41,ERC20PaymentClientMock.addPaymentOrderUnchecked FNDA:5,ERC20PaymentClientMock.addPaymentOrderUnchecked DA:43,5 @@ -2645,13 +2622,13 @@ FN:55,ERC20PaymentClientMock.addPaymentOrders FNDA:1,ERC20PaymentClientMock.addPaymentOrders DA:56,1 FN:62,ERC20PaymentClientMock._ensureTokenBalance -FNDA:91819,ERC20PaymentClientMock._ensureTokenBalance -DA:66,91819 -BRDA:66,0,0,87515 -BRDA:66,0,1,91819 -DA:67,91819 -DA:69,87515 -DA:70,87515 +FNDA:92936,ERC20PaymentClientMock._ensureTokenBalance +DA:66,92936 +BRDA:66,0,0,88600 +BRDA:66,0,1,92936 +DA:67,92936 +DA:69,88600 +DA:70,88600 FN:74,ERC20PaymentClientMock._ensureTokenAllowance FNDA:3844,ERC20PaymentClientMock._ensureTokenAllowance DA:78,3844 @@ -2680,8 +2657,8 @@ FN:28,ModuleManagerMock.initNoInitializer FNDA:1,ModuleManagerMock.initNoInitializer DA:29,1 FN:32,ModuleManagerMock.__ModuleManager_isAuthorized -FNDA:105054,ModuleManagerMock.__ModuleManager_isAuthorized -DA:38,105054 +FNDA:108875,ModuleManagerMock.__ModuleManager_isAuthorized +DA:38,108875 FNF:5 FNH:4 LF:5 diff --git a/src/modules/authorizer/IAuthorizer.sol b/src/modules/authorizer/IAuthorizer.sol index 9f9ba7e52..0d62d7f37 100644 --- a/src/modules/authorizer/IAuthorizer.sol +++ b/src/modules/authorizer/IAuthorizer.sol @@ -26,22 +26,7 @@ interface IAuthorizer is IAccessControlEnumerableUpgradeable { error Module__RoleAuthorizer__OwnerRoleCannotBeEmpty(); //-------------------------------------------------------------------------- - // Overloaded and overriden functions - - /* /// @notice Returns if an address has the Orchestrator Owner Role - /// @param who The adress to be checked. - function isAuthorized(address who) external view returns (bool); - - /// @notice Overloads {isAuthorized} for a Module to ask whether an address holds the required role to execute - /// the current transaction. - /// @param role The identifier of the role we want to check - /// @param who The address on which to perform the check. - /// @dev If the role is not self-managed, it will default to the orchestrator roles - /// @dev If not, it will use the calling address to generate the role ID. Therefore, for checking on anything other than itself, hasRole() should be used - function isAuthorized(uint8 role, address who) - external - view - returns (bool); */ + // Functions /// @notice Asks whether an address holds the required module role to execute /// the current transaction. @@ -53,9 +38,6 @@ interface IAuthorizer is IAccessControlEnumerableUpgradeable { view returns (bool); - //-------------------------------------------------------------------------- - // Functions - /// @notice Helper function to generate a bytes32 role hash for a module role /// @param module The address of the module to generate the hash for /// @param role The ID number of the role to generate the hash for diff --git a/src/modules/authorizer/RoleAuthorizer.sol b/src/modules/authorizer/RoleAuthorizer.sol index b6cacb6e4..707690b16 100644 --- a/src/modules/authorizer/RoleAuthorizer.sol +++ b/src/modules/authorizer/RoleAuthorizer.sol @@ -16,17 +16,6 @@ contract RoleAuthorizer is //-------------------------------------------------------------------------- // Storage - /* // Core roles for a orchestrator. They correspond to uint8(0) and uint(1) - // NOTE that orchestrator owner can register more global roles using numbers from 2 onward. They'l need to go through the DEFAULT_ADMIN_ROLE for this. - enum CoreRoles { - OWNER, // Full Access to Protected Functions - MANAGER // Partial Access to Protected Functions - } - */ - // Stores the if a module wants to use it's own roles - // If false it uses the orchestrator's core roles. - mapping(address => bool) public selfManagedModules; - // Stored for easy public reference. Other Modules can assume the following roles to exist bytes32 public constant ORCHESTRATOR_OWNER_ROLE = "0x01"; bytes32 public constant ORCHESTRATOR_MANAGER_ROLE = "0x02"; @@ -45,14 +34,6 @@ contract RoleAuthorizer is _; } - /* /// @notice Verifies that the calling module has turned on self-management - modifier onlySelfManaged() { - if (!selfManagedModules[_msgSender()]) { - revert Module__RoleAuthorizer__ModuleNotSelfManaged(); - } - _; - } */ - /// @notice Verifies that the owner being removed is not the last one modifier notLastOwner(bytes32 role) { if ( @@ -94,12 +75,6 @@ contract RoleAuthorizer is // so they can whitelist an address which then will have full write access to the roles in the system. This is mainly intended for safety/recovery situations, // Modules can opt out of this on a per-role basis by setting the admin role to "BURN_ADMIN_ROLE". - // Store RoleIDs for the Orchestrator roles: - /* ORCHESTRATOR_OWNER_ROLE = - generateRoleId(address(orchestrator()), uint8(CoreRoles.OWNER)); - ORCHESTRATOR_MANAGER_ROLE = - generateRoleId(address(orchestrator()), uint8(CoreRoles.MANAGER)); */ - //We preliminarily grant admin role to the caller _grantRole(ORCHESTRATOR_OWNER_ROLE, _msgSender()); @@ -142,34 +117,6 @@ contract RoleAuthorizer is //-------------------------------------------------------------------------- // Public functions - // View functions - /* - /// @inheritdoc IAuthorizer - /// @dev Implements the function of the IAuthorizer interface by defauling to check if the caller holds the OWNER role. - function isAuthorized(address who) external view returns (bool) { - // In case no role is specfied, we ask if the caller is an owner - return hasRole(ORCHESTRATOR_OWNER_ROLE, who); - } - - /// @inheritdoc IAuthorizer - function isAuthorized(bytes32 role, address who) - external - view - virtual - returns (bool) - { - //Note: since it uses msgSenderto generate ID, this should only be used by modules. Users should call hasRole() - bytes32 roleId; - // If the module uses its own roles, check if account has the role. - // else check if account has role in orchestrator - if (selfManagedModules[_msgSender()]) { - roleId = generateRoleId(_msgSender(), role); - } else { - roleId = generateRoleId(address(orchestrator()), role); - } - return hasRole(roleId, who); - } - */ /// @inheritdoc IAuthorizer function hasModuleRole(bytes32 role, address who) external @@ -192,25 +139,11 @@ contract RoleAuthorizer is return keccak256(abi.encodePacked(module, role)); } - // State-altering functions - - /* /// @inheritdoc IAuthorizer - function toggleModuleSelfManagement() external onlyModule(_msgSender()) { - if (selfManagedModules[_msgSender()]) { - selfManagedModules[_msgSender()] = false; - emit setRoleSelfManagement(_msgSender(), false); - } else { - selfManagedModules[_msgSender()] = true; - emit setRoleSelfManagement(_msgSender(), true); - } - } */ - /// @inheritdoc IAuthorizer function grantRoleFromModule(bytes32 role, address target) external onlyModule(_msgSender()) { - selfManagedModules[_msgSender()] = true; // placeholder for in between removing uint8 role system bytes32 roleId = generateRoleId(_msgSender(), role); _grantRole(roleId, target); } @@ -260,12 +193,12 @@ contract RoleAuthorizer is } /// @inheritdoc IAuthorizer - function getOwnerRole() public view returns (bytes32) { + function getOwnerRole() public pure returns (bytes32) { return ORCHESTRATOR_OWNER_ROLE; } /// @inheritdoc IAuthorizer - function getManagerRole() public view returns (bytes32) { + function getManagerRole() public pure returns (bytes32) { return ORCHESTRATOR_MANAGER_ROLE; } } diff --git a/src/modules/authorizer/TokenGatedRoleAuthorizer.sol b/src/modules/authorizer/TokenGatedRoleAuthorizer.sol index 32c135bf7..bb16d255f 100644 --- a/src/modules/authorizer/TokenGatedRoleAuthorizer.sol +++ b/src/modules/authorizer/TokenGatedRoleAuthorizer.sol @@ -65,38 +65,6 @@ contract TokenGatedRoleAuthorizer is //-------------------------------------------------------------------------- // Overloaded and overriden functions - /* /// @inheritdoc RoleAuthorizer - /// @dev We add a check to call a different function if the role is token-gated. - function isAuthorized(uint8 role, address who) - public - view - override(RoleAuthorizer, IAuthorizer) - returns (bool) - { - //Note: since it uses msgSender to generate ID, this should only be used by modules. Users should call hasRole() - bytes32 roleId; - // If the module self-manages its roles, check if account has the role. - if (selfManagedModules[_msgSender()]) { - roleId = generateRoleId(_msgSender(), role); - //check if token gated: - if (isTokenGated[roleId]) { - return hasTokenRole(roleId, who); - } else { - return hasRole(roleId, who); - } - // If not, check the account against the orchestrator roles - } else { - roleId = generateRoleId(address(orchestrator()), role); - //check if token gated: - if (isTokenGated[roleId]) { - //TODO add tests - return hasTokenRole(roleId, who); - } else { - return hasRole(roleId, who); - } - } - } */ - function hasRole(bytes32 roleId, address account) public view @@ -195,7 +163,6 @@ contract TokenGatedRoleAuthorizer is address token, uint threshold ) external onlyModule(_msgSender()) { - selfManagedModules[_msgSender()] = true; // placeholder for in between removing uint8 role system bytes32 roleId = generateRoleId(_msgSender(), role); _grantRole(roleId, token); _setThreshold(roleId, token, threshold); @@ -206,7 +173,6 @@ contract TokenGatedRoleAuthorizer is public onlyModule(_msgSender()) { - //TODO write tests bytes32 roleId = generateRoleId(_msgSender(), role); _setThreshold(roleId, token, threshold); } diff --git a/src/modules/logicModule/IBountyManager.sol b/src/modules/logicModule/IBountyManager.sol index 22569b951..d284a247d 100644 --- a/src/modules/logicModule/IBountyManager.sol +++ b/src/modules/logicModule/IBountyManager.sol @@ -5,15 +5,6 @@ import {IERC20PaymentClient} from "src/modules/base/mixins/IERC20PaymentClient.sol"; interface IBountyManager is IERC20PaymentClient { - //-------------------------------------------------------------------------- - // Enums - - enum Roles { - BountyAdmin, - ClaimAdmin, - VerifyAdmin - } - //-------------------------------------------------------------------------- // Types diff --git a/test/e2e/CreateNewOrchestrator.t.sol b/test/e2e/CreateNewOrchestrator.t.sol index dbf9ea730..5ab41324e 100644 --- a/test/e2e/CreateNewOrchestrator.t.sol +++ b/test/e2e/CreateNewOrchestrator.t.sol @@ -318,8 +318,7 @@ contract OrchestratorCreation is Test { //-------------------------------------------------------------------------------- // Adding Module - // TODO Substitute with BountyManager - //Create milestoneManagerConfigData + //Create bountyManagerConfigData //Note: This bytes array is used for transmitting data in a generalized way // to the modules during they initilization via the modulefactory // Some Modules might need additional Deployment/Configuration data diff --git a/test/modules/authorizer/RoleAuthorizer.t.sol b/test/modules/authorizer/RoleAuthorizer.t.sol index 2d6a43e91..4e51d25d2 100644 --- a/test/modules/authorizer/RoleAuthorizer.t.sol +++ b/test/modules/authorizer/RoleAuthorizer.t.sol @@ -445,32 +445,6 @@ contract RoleAuthorizerTest is Test { ); } - /* function testGrantRoleFromModuleFailsIfModuleNotSelfManaged() public { - address newModule = _setupMockSelfManagedModule(); - - vm.startPrank(newModule); - _authorizer.toggleModuleSelfManagement(); - - vm.expectRevert( - abi.encodeWithSelector( - IAuthorizer - .Module__RoleAuthorizer__ModuleNotSelfManaged - .selector - ) - ); - _authorizer.grantRoleFromModule(uint8(ModuleRoles.ROLE_0), ALBA); - - vm.stopPrank(); - - assertEq( - _authorizer.hasRole( - _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_0)), - ALBA - ), - false - ); - } */ - function testGrantRoleFromModuleIdempotence() public { address newModule = _setupMockSelfManagedModule(); @@ -563,32 +537,6 @@ contract RoleAuthorizerTest is Test { ); } - /* function testRevokeRoleFromModuleFailsIfModuleNotSelfManaged() public { - address newModule = _setupMockSelfManagedModule(); - - vm.startPrank(newModule); - _authorizer.toggleModuleSelfManagement(); - - vm.expectRevert( - abi.encodeWithSelector( - IAuthorizer - .Module__RoleAuthorizer__ModuleNotSelfManaged - .selector - ) - ); - _authorizer.grantRoleFromModule(ROLE_0, BOB); - - vm.stopPrank(); - - assertEq( - _authorizer.hasRole( - _authorizer.generateRoleId(newModule, ROLE_0), - BOB - ), - false - ); - } - */ function testRevokeRoleFromModuleIdempotence() public { address newModule = _setupMockSelfManagedModule(); @@ -610,7 +558,6 @@ contract RoleAuthorizerTest is Test { } // Test grant and revoke global roles - // TODO // Grant global roles function testGrantGlobalRole() public { @@ -715,39 +662,6 @@ contract RoleAuthorizerTest is Test { vm.stopPrank(); } - // Test that admin can change module roles if self managed and if not - function testAdminIgnoresIfRoleIsSelfManaged() public { - // First, we make ALBA admin - bytes32 adminRole = _authorizer.DEFAULT_ADMIN_ROLE(); - vm.prank(ALBA); - _authorizer.grantRole(adminRole, ALBA); - assertTrue(_authorizer.hasRole(adminRole, ALBA)); - - //Then we set up a mock module - address newModule = _setupMockSelfManagedModule(); - bytes32 roleId = _authorizer.generateRoleId(newModule, ROLE_0); - - // ALBA can now freely grant and revoke roles - assertEq(_authorizer.hasRole(roleId, BOB), false); - vm.startPrank(ALBA); - _authorizer.grantRole(roleId, BOB); - assertEq(_authorizer.hasRole(roleId, BOB), true); - _authorizer.revokeRole(roleId, BOB); - assertEq(_authorizer.hasRole(roleId, BOB), false); - vm.stopPrank(); - - //TODO reiew if this test is still necessary - - /* - // ALBA can still freely grant and revoke roles - assertEq(_authorizer.hasRole(roleId, BOB), false); - vm.startPrank(ALBA); - _authorizer.grantRole(roleId, BOB); - assertEq(_authorizer.hasRole(roleId, BOB), true); - _authorizer.revokeRole(roleId, BOB); - assertEq(_authorizer.hasRole(roleId, BOB), false); - vm.stopPrank();*/ - } // Test that ADMIN cannot change module roles if admin role was burned function testAdminCannotModifyRoleIfAdminBurned() public { @@ -773,66 +687,6 @@ contract RoleAuthorizerTest is Test { vm.stopPrank(); } - /* // Test toggleModuleSelfManagement - // Test selfManagement gets recognized - function testtoggleModuleSelfManagement() public { - // we set up a mock module and buffer the role with burned admin - address newModule = _setupMockSelfManagedModule(); - - // As per the genrating function, it starts as self-managed - assertTrue(_authorizer.selfManagedModules(newModule)); - // We return the module to managed state. - vm.prank(newModule); - _authorizer.toggleModuleSelfManagement(); - - //Now it isn't self-managed anymore - assertFalse(_authorizer.selfManagedModules(newModule)); - } */ - // Test module is using own roles when selfmanaged - /* - function testModuleOnlyUsesOwnRolesWhenSelfManaged() public { - // First, we set up a modul and authorize BOB - address newModule = _setupMockSelfManagedModule(); - - vm.startPrank(newModule); - _authorizer.grantRoleFromModule(ROLE_0, BOB); - - // BOB is authorized - assertTrue(_authorizer.isAuthorized(uint8(ModuleRoles.ROLE_0), BOB)); - - // But ALBA, as owner, is not - assertFalse(_authorizer.isAuthorized(uint8(0), ALBA)); - - vm.stopPrank(); - } */ - - /* function testModuleOnlyUsesOrchestratorRolesWhenNotSelfManaged() public { - // First, we set up a module and authorize BOB - address newModule = _setupMockSelfManagedModule(); - - vm.startPrank(newModule); - _authorizer.grantRoleFromModule(uint8(ModuleRoles.ROLE_0), BOB); - - // BOB is authorized - assertTrue(_authorizer.isAuthorized(uint8(ModuleRoles.ROLE_0), BOB)); - - // We return the module to managed state. - _authorizer.toggleModuleSelfManagement(); - - // BOB is not authorized anymore - assertFalse(_authorizer.isAuthorized(uint8(0), BOB)); - - // But ALBA, as owner, is - assertTrue(_authorizer.isAuthorized(uint8(0), ALBA)); - - vm.stopPrank(); - } */ - // Test module can correctly return to managed mode - - /* function testModuleReturnToManagedMode() public { - //testModuleOnlyUsesOrchestratorRolesWhenNotSelfManaged implicitly tests this - } */ - // Test the burnAdminFromModuleRole // -> Test burnAdmin changes state function testBurnAdminChangesRoleState() public { @@ -871,31 +725,6 @@ contract RoleAuthorizerTest is Test { vm.stopPrank(); } - /* // -> Modules with burnt admin CAN return to managed state - function testBurnedModuleCorrectlyReturnToManagedState() public { - // Same as testModuleOnlyUsesOrchestratorRolesWhenNotSelfManaged but with ROLE_1 - - // First, we set up a module and authorize BOB - address newModule = _setupMockSelfManagedModule(); - - vm.startPrank(newModule); - _authorizer.grantRoleFromModule(uint8(ModuleRoles.ROLE_1), BOB); - - // BOB is authorized - assertTrue(_authorizer.isAuthorized(uint8(ModuleRoles.ROLE_1), BOB)); - - // We return the module to managed state. - _authorizer.toggleModuleSelfManagement(); - - // BOB is not authorized anymore - assertFalse(_authorizer.isAuthorized(uint8(1), BOB)); - - // But ALBA, as owner, is (uint8(0) because we are querying her owner role, not the orchestrator manager role) - assertTrue(_authorizer.isAuthorized(uint8(0), ALBA)); - - vm.stopPrank(); - } */ - // ========================================================================= // Test Helper Functions diff --git a/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol b/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol index 0fed31360..c2ea44bc7 100644 --- a/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol +++ b/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol @@ -436,6 +436,57 @@ contract TokenGatedRoleAuthorizerTest is Test { _authorizer.setThreshold(roleId, address(roleToken), 500); } + // Test setThresholdFromModule + + function testSetThresholdFromModule() public { + bytes32 roleId = setUpTokenGatedRole( + address(mockModule), ROLE_TOKEN, address(roleToken), 500 + ); + vm.prank(address(mockModule)); + _authorizer.setThresholdFromModule(ROLE_TOKEN, address(roleToken), 1000); + assertEq( + _authorizer.getThresholdValue(roleId, address(roleToken)), 1000 + ); + } + + // invalid threshold from module + + function testSetThresholdFromModuleFailsIfInvalid() public { + bytes32 role = ROLE_TOKEN; + vm.startPrank(address(mockModule)); + _authorizer.makeRoleTokenGatedFromModule(role); + + _authorizer.grantTokenRoleFromModule(role, address(roleToken), 100); + + vm.expectRevert( + abi.encodeWithSelector( + ITokenGatedRoleAuthorizer + .Module__TokenGatedRoleAuthorizer__InvalidThreshold + .selector, + 0 + ) + ); + _authorizer.setThresholdFromModule(ROLE_TOKEN, address(roleToken), 0); + + vm.stopPrank(); + } + + function testSetThresholdFromModuleFailsIfNotTokenGated() public { + // we set BOB as admin + makeAddressDefaultAdmin(BOB); + + vm.prank(address(mockModule)); + //We didn't make the role token-gated beforehand + vm.expectRevert( + abi.encodeWithSelector( + ITokenGatedRoleAuthorizer + .Module__TokenGatedRoleAuthorizer__RoleNotTokenGated + .selector + ) + ); + _authorizer.setThresholdFromModule(ROLE_TOKEN, address(roleToken), 500); + } + //Test Authorization // Test token authorization diff --git a/test/modules/logicModule/BountyManager.t.sol b/test/modules/logicModule/BountyManager.t.sol index fb5c337f9..8dc55e4cc 100644 --- a/test/modules/logicModule/BountyManager.t.sol +++ b/test/modules/logicModule/BountyManager.t.sol @@ -376,7 +376,6 @@ contract BountyManagerTest is ModuleTest { _authorizer.setIsAuthorized(address(this), false); //onlyBountyAdmin - //TODO: Update Role mention vm.expectRevert( abi.encodeWithSelector( IModule.Module__CallerNotAuthorized.selector, diff --git a/test/utils/mocks/modules/AuthorizerMock.sol b/test/utils/mocks/modules/AuthorizerMock.sol index 85349d14e..db09c728e 100644 --- a/test/utils/mocks/modules/AuthorizerMock.sol +++ b/test/utils/mocks/modules/AuthorizerMock.sol @@ -141,11 +141,11 @@ contract AuthorizerMock is IAuthorizer, Module { function renounceRole(bytes32, address) external pure {} - function getOwnerRole() external view returns (bytes32) { + function getOwnerRole() external pure returns (bytes32) { return "0x01"; } - function getManagerRole() external view returns (bytes32) { + function getManagerRole() external pure returns (bytes32) { return "0x02"; } From 6819f3b3b009aeb502254d44ef7c32a671dfd6e6 Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Fri, 25 Aug 2023 09:38:44 +0200 Subject: [PATCH 29/32] Felix review fixes --- .../authorizer/TokenGatedRoleAuthorizer.sol | 57 +++++++++++-------- .../authorizer/SingleVoteGovernor.t.sol | 13 +++-- 2 files changed, 43 insertions(+), 27 deletions(-) diff --git a/src/modules/authorizer/TokenGatedRoleAuthorizer.sol b/src/modules/authorizer/TokenGatedRoleAuthorizer.sol index bb16d255f..7251e2f8a 100644 --- a/src/modules/authorizer/TokenGatedRoleAuthorizer.sol +++ b/src/modules/authorizer/TokenGatedRoleAuthorizer.sol @@ -73,7 +73,7 @@ contract TokenGatedRoleAuthorizer is returns (bool) { if (isTokenGated[roleId]) { - return hasTokenRole(roleId, account); + return _hasTokenRole(roleId, account); } else { return super.hasRole(roleId, account); } @@ -108,28 +108,7 @@ contract TokenGatedRoleAuthorizer is onlyTokenGated(role) returns (bool) { - uint numberOfAllowedTokens = getRoleMemberCount(role); - - for (uint i; i < numberOfAllowedTokens; ++i) { - address tokenAddr = getRoleMember(role, i); - bytes32 thresholdId = keccak256(abi.encodePacked(role, tokenAddr)); - uint tokenThreshold = thresholdMap[thresholdId]; - - //Should work with both ERC20 and ERC721 - try TokenInterface(tokenAddr).balanceOf(who) returns ( - uint tokenBalance - ) { - if (tokenBalance >= tokenThreshold) { - return true; - } - } catch { - // If the call fails, we continue to the next token. - // Emitting an event here would make this function (and the functions calling it) non-view. - // note we already enforce Interface implementation when granting the role. - } - } - - return false; + return _hasTokenRole(role, who); } /// @inheritdoc ITokenGatedRoleAuthorizer @@ -215,4 +194,36 @@ contract TokenGatedRoleAuthorizer is thresholdMap[thresholdId] = threshold; emit ChangedTokenThreshold(roleId, token, threshold); } + + /// @notice Internal function that checks if an account qualifies for a token-gated role. + /// @param role The role to be checked. + /// @param who The account to be checked. + function _hasTokenRole(bytes32 role, address who) + internal + view + returns (bool) + { + uint numberOfAllowedTokens = getRoleMemberCount(role); + + for (uint i; i < numberOfAllowedTokens; ++i) { + address tokenAddr = getRoleMember(role, i); + bytes32 thresholdId = keccak256(abi.encodePacked(role, tokenAddr)); + uint tokenThreshold = thresholdMap[thresholdId]; + + //Should work with both ERC20 and ERC721 + try TokenInterface(tokenAddr).balanceOf(who) returns ( + uint tokenBalance + ) { + if (tokenBalance >= tokenThreshold) { + return true; + } + } catch { + // If the call fails, we continue to the next token. + // Emitting an event here would make this function (and the functions calling it) non-view. + // note we already enforce Interface implementation when granting the role. + } + } + + return false; + } } diff --git a/test/modules/authorizer/SingleVoteGovernor.t.sol b/test/modules/authorizer/SingleVoteGovernor.t.sol index f6a7feab7..9cacfda4a 100644 --- a/test/modules/authorizer/SingleVoteGovernor.t.sol +++ b/test/modules/authorizer/SingleVoteGovernor.t.sol @@ -224,13 +224,15 @@ contract SingleVoteGovernorTest is ModuleTest { function testInit() public override(ModuleTest) { assertEq(_orchestrator.isModule(address(_governor)), true); - assertEq(_authorizer.hasRole("0x01", address(_governor)), true); // Owner role + bytes32 owner = _authorizer.getOwnerRole(); + + assertEq(_authorizer.hasRole(owner, address(_governor)), true); // Owner role assertEq(_governor.isVoter(ALBA), true); assertEq(_governor.isVoter(BOB), true); assertEq(_governor.isVoter(COBIE), true); - assertEq(_authorizer.hasRole("0x01", address(this)), false); - assertEq(_authorizer.hasRole("0x01", address(_orchestrator)), false); + assertEq(_authorizer.hasRole(owner, address(this)), false); + assertEq(_authorizer.hasRole(owner, address(_orchestrator)), false); assertEq(_governor.isVoter(address(this)), false); assertEq(_governor.isVoter(address(_orchestrator)), false); @@ -328,7 +330,10 @@ contract SingleVoteGovernorTest is ModuleTest { ) ); - assertEq(_authorizer.hasRole("0x01", address(_governor)), true); + assertEq( + _authorizer.hasRole(_authorizer.getOwnerRole(), address(_governor)), + true + ); assertEq(_governor.isVoter(ALBA), true); assertEq(_governor.isVoter(BOB), true); assertEq(_governor.isVoter(COBIE), true); From 9c4901d9b51032f1ff400bb5481052b0f4b3d997 Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Fri, 25 Aug 2023 09:49:01 +0200 Subject: [PATCH 30/32] fix lib version bug --- .gitmodules | 6 +++--- lib/forge-std | 2 +- lib/openzeppelin-contracts | 2 +- lib/openzeppelin-contracts-upgradeable | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitmodules b/.gitmodules index 9296efd5b..1386ebdb6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ [submodule "lib/forge-std"] path = lib/forge-std - url = https://github.com/foundry-rs/forge-std + url = https://github.com/foundry-r/forge-std [submodule "lib/openzeppelin-contracts"] path = lib/openzeppelin-contracts - url = https://github.com/OpenZeppelin/openzeppelin-contracts + url = https://github.com/openzeppelin/openzeppelin-contracts [submodule "lib/openzeppelin-contracts-upgradeable"] path = lib/openzeppelin-contracts-upgradeable - url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable + url = https://github.com/openzeppelin/openzeppelin-contracts-upgradeable diff --git a/lib/forge-std b/lib/forge-std index 1cefc0e4e..fc560fa34 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit 1cefc0e4e3d2a1f604c654004c90bd6701b2b5e2 +Subproject commit fc560fa34fa12a335a50c35d92e55a6628ca467c diff --git a/lib/openzeppelin-contracts b/lib/openzeppelin-contracts index 54b3f1434..db9ee953a 160000 --- a/lib/openzeppelin-contracts +++ b/lib/openzeppelin-contracts @@ -1 +1 @@ -Subproject commit 54b3f14346da01ba0d159114b399197fea8b7cda +Subproject commit db9ee953a17166a51fff42b3c4a29203ef92a492 diff --git a/lib/openzeppelin-contracts-upgradeable b/lib/openzeppelin-contracts-upgradeable index f6febd79e..f6c4c9c4e 160000 --- a/lib/openzeppelin-contracts-upgradeable +++ b/lib/openzeppelin-contracts-upgradeable @@ -1 +1 @@ -Subproject commit f6febd79e2a3a17e26969dd0d450c6ebd64bf459 +Subproject commit f6c4c9c4ec601665ca74d2c9dddf547fc425658c From 6ac1865d5863186600b7d06fbe0d9a4b9bc22e4a Mon Sep 17 00:00:00 2001 From: FHieser Date: Fri, 25 Aug 2023 11:04:46 +0200 Subject: [PATCH 31/32] solve merge conflicts --- .gas-snapshot | 457 +++-- lcov.info | 1725 +++++++++--------- src/modules/logicModule/BountyManager.sol | 2 +- test/modules/logicModule/BountyManager.t.sol | 3 +- 4 files changed, 1073 insertions(+), 1114 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index dd5ecb045..6b9e938ae 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,37 +1,37 @@ BeaconProxyTest:testDeploymentInvariants() (gas: 108566) -BeaconProxyTest:testImplementation(uint256) (runs: 256, μ: 61827, ~: 62916) +BeaconProxyTest:testImplementation(uint256) (runs: 256, μ: 61849, ~: 62938) BeaconTest:testDeploymentInvariants() (gas: 13655) BeaconTest:testSupportsInterface() (gas: 5585) -BeaconTest:testUpgradeTo() (gas: 2549819) +BeaconTest:testUpgradeTo() (gas: 2540609) BeaconTest:testUpgradeToFailsIfImplementationNotContract() (gas: 13099) BeaconTest:testUpgradeToOnlyCallableByOwner(address) (runs: 256, μ: 11768, ~: 11768) -BountyManagerLifecycle:test_e2e_BountyManagerLifecycle() (gas: 3989391) -BountyManagerTest:testAddBounty(uint256,uint256,uint256,bytes) (runs: 256, μ: 2558580, ~: 2446605) -BountyManagerTest:testAddBountyModifierInPosition() (gas: 63018) -BountyManagerTest:testAddClaim(uint256,address[],uint256[],bytes) (runs: 256, μ: 137563648, ~: 106686449) -BountyManagerTest:testAddClaimModifierInPosition() (gas: 252109) -BountyManagerTest:testContributorsNotChanged(bool,address,uint256) (runs: 256, μ: 776687, ~: 832263) -BountyManagerTest:testGetBountyInformationModifierInPosition() (gas: 15882) +BountyManagerLifecycle:test_e2e_BountyManagerLifecycle() (gas: 3919822) +BountyManagerTest:testAddBounty(uint256,uint256,uint256,bytes) (runs: 256, μ: 2523487, ~: 2434234) +BountyManagerTest:testAddBountyModifierInPosition() (gas: 63511) +BountyManagerTest:testAddClaim(uint256,address[],uint256[],bytes) (runs: 256, μ: 139305208, ~: 124961825) +BountyManagerTest:testAddClaimModifierInPosition() (gas: 252479) +BountyManagerTest:testContributorsNotChanged(bool,address,uint256) (runs: 256, μ: 777222, ~: 832123) +BountyManagerTest:testGetBountyInformationModifierInPosition() (gas: 15837) BountyManagerTest:testGetClaimInformationModifierInPosition() (gas: 16309) BountyManagerTest:testInit() (gas: 210) -BountyManagerTest:testLockBounty() (gas: 190873) -BountyManagerTest:testLockBountyModifierInPosition() (gas: 215717) -BountyManagerTest:testLocked(bool) (runs: 256, μ: 762851, ~: 825850) -BountyManagerTest:testNotClaimed(bool) (runs: 256, μ: 828706, ~: 825871) -BountyManagerTest:testOnlyClaimContributor(address[],uint256[],address) (runs: 256, μ: 5353162, ~: 6092880) -BountyManagerTest:testReinitFails() (gas: 31571) -BountyManagerTest:testUpdateBounty(bytes) (runs: 256, μ: 237100, ~: 223676) -BountyManagerTest:testUpdateBountyModifierInPosition() (gas: 220349) -BountyManagerTest:testUpdateClaimContributors(address[],uint256[]) (runs: 256, μ: 5706259, ~: 6350719) -BountyManagerTest:testUpdateClaimContributorsModifierInPosition() (gas: 1256305) -BountyManagerTest:testUpdateClaimDetails(bytes) (runs: 256, μ: 592315, ~: 578555) -BountyManagerTest:testUpdateClaimDetailsModifierInPosition() (gas: 1219559) -BountyManagerTest:testValidBountyId(uint256,uint256) (runs: 256, μ: 40652839, ~: 41108006) -BountyManagerTest:testValidClaimId(uint256,uint256) (runs: 256, μ: 136051760, ~: 133989336) -BountyManagerTest:testValidContributorsForBounty(uint256,uint256,address[],uint256[]) (runs: 256, μ: 576061, ~: 269657) -BountyManagerTest:testValidPayoutAmounts(uint256,uint256) (runs: 256, μ: 84431, ~: 29974) -BountyManagerTest:testVerifyClaim(address[],uint256[],bytes) (runs: 256, μ: 10086457, ~: 11095160) -BountyManagerTest:testVerifyClaimModifierInPosition() (gas: 1266063) +BountyManagerTest:testLockBounty() (gas: 190720) +BountyManagerTest:testLockBountyModifierInPosition() (gas: 216047) +BountyManagerTest:testLocked(bool) (runs: 256, μ: 760034, ~: 825710) +BountyManagerTest:testNotClaimed(bool) (runs: 256, μ: 828670, ~: 825731) +BountyManagerTest:testOnlyClaimContributor(address[],uint256[],address) (runs: 256, μ: 5352985, ~: 6091519) +BountyManagerTest:testReinitFails() (gas: 31593) +BountyManagerTest:testUpdateBounty(bytes) (runs: 256, μ: 236969, ~: 223545) +BountyManagerTest:testUpdateBountyModifierInPosition() (gas: 220701) +BountyManagerTest:testUpdateClaimContributors(address[],uint256[]) (runs: 256, μ: 5703444, ~: 6350712) +BountyManagerTest:testUpdateClaimContributorsModifierInPosition() (gas: 1256432) +BountyManagerTest:testUpdateClaimDetails(bytes) (runs: 256, μ: 592266, ~: 578506) +BountyManagerTest:testUpdateClaimDetailsModifierInPosition() (gas: 1219397) +BountyManagerTest:testValidBountyId(uint256,uint256) (runs: 256, μ: 41144364, ~: 42855134) +BountyManagerTest:testValidClaimId(uint256,uint256) (runs: 256, μ: 136819516, ~: 136351521) +BountyManagerTest:testValidContributorsForBounty(uint256,uint256,address[],uint256[]) (runs: 256, μ: 602689, ~: 270427) +BountyManagerTest:testValidPayoutAmounts(uint256,uint256) (runs: 256, μ: 87268, ~: 29920) +BountyManagerTest:testVerifyClaim(address[],uint256[],bytes) (runs: 256, μ: 10084741, ~: 11090557) +BountyManagerTest:testVerifyClaimModifierInPosition() (gas: 1266071) Deployment:testContructor() (gas: 22575) Deployment:testInitialization() (gas: 22554) Deployment:testInitilizationFailsIfMintAlreadyExecuted(address,uint256) (runs: 256, μ: 183728, ~: 183558) @@ -54,17 +54,17 @@ ERC20:testTransferAll(address,address,uint256) (runs: 256, μ: 209763, ~: 209763 ERC20:testTransferAllFrom(address,address,uint256) (runs: 256, μ: 216650, ~: 216622) ERC20:testTransferAllFromWithZeroToken(address,address) (runs: 256, μ: 282655, ~: 282630) ERC20:testTransferFrom(address,address,uint256) (runs: 256, μ: 216601, ~: 216573) -ERC20PaymentClientTest:testAddPaymentOrder(uint256,address,uint256,uint256) (runs: 256, μ: 20994, ~: 21264) -ERC20PaymentClientTest:testAddPaymentOrderFailsForInvalidAmount() (gas: 9470) -ERC20PaymentClientTest:testAddPaymentOrderFailsForInvalidRecipient() (gas: 11858) -ERC20PaymentClientTest:testAddPaymentOrders() (gas: 333592) -ERC20PaymentClientTest:testCollectPaymentOrders(uint256,address,uint256,uint256) (runs: 256, μ: 41937, ~: 42210) +ERC20PaymentClientTest:testAddPaymentOrder(uint256,address,uint256,uint256) (runs: 256, μ: 20915, ~: 21199) +ERC20PaymentClientTest:testAddPaymentOrderFailsForInvalidAmount() (gas: 9447) +ERC20PaymentClientTest:testAddPaymentOrderFailsForInvalidRecipient() (gas: 11812) +ERC20PaymentClientTest:testAddPaymentOrders() (gas: 333527) +ERC20PaymentClientTest:testCollectPaymentOrders(uint256,address,uint256,uint256) (runs: 256, μ: 41848, ~: 42145) ERC20PaymentClientTest:testCollectPaymentOrdersFailsCallerNotAuthorized() (gas: 11805) -ERC20PaymentClientTest:testEnsureTokenAllowance(uint256,uint256) (runs: 256, μ: 2461360, ~: 2458918) -ERC20PaymentClientTest:testEnsureTokenBalance(uint256) (runs: 256, μ: 2631869, ~: 2634512) -ERC20PaymentClientTest:testIsAuthorizedPaymentProcessor(address) (runs: 256, μ: 2425740, ~: 2425740) -FundManagement:test_e2e_OrchestratorFundManagement() (gas: 2449268) -LibMetadataTest:testIdentifier((uint256,uint256,string,string)) (runs: 256, μ: 2761, ~: 2787) +ERC20PaymentClientTest:testEnsureTokenAllowance(uint256,uint256) (runs: 256, μ: 2457041, ~: 2459694) +ERC20PaymentClientTest:testEnsureTokenBalance(uint256) (runs: 256, μ: 2627410, ~: 2629898) +ERC20PaymentClientTest:testIsAuthorizedPaymentProcessor(address) (runs: 256, μ: 2421126, ~: 2421126) +FundManagement:test_e2e_OrchestratorFundManagement() (gas: 2445863) +LibMetadataTest:testIdentifier((uint256,uint256,string,string)) (runs: 256, μ: 2768, ~: 2787) LibMetadataTest:testMetadataInvalidIfTitleEmpty(uint256,uint256) (runs: 256, μ: 3552, ~: 3552) LibMetadataTest:testMetadataInvalidIfURLEmpty(uint256,uint256) (runs: 256, μ: 3494, ~: 3494) LibMetadataTest:testMetadataInvalidIfVersionOnlyZero(uint256,uint256) (runs: 256, μ: 725, ~: 725) @@ -86,17 +86,17 @@ LinkedIdListTest:testValidId(uint256[],uint256) (runs: 256, μ: 3410871, ~: 3581 LinkedIdListTest:testValidMoveParameter(uint256[],uint256,uint256,uint256) (runs: 256, μ: 3327895, ~: 3175285) LinkedIdListTest:testValidNewId(uint256[],uint256) (runs: 256, μ: 3428955, ~: 3601866) LinkedIdListTest:testValidPosition(uint256[],uint256) (runs: 256, μ: 3410873, ~: 3580480) -MetadataManagerTest:testInit() (gas: 491680) -MetadataManagerTest:testInit2MetadataManager() (gas: 57826) +MetadataManagerTest:testInit() (gas: 487718) +MetadataManagerTest:testInit2MetadataManager() (gas: 57984) MetadataManagerTest:testReinitFails() (gas: 31524) -MetadataManagerTest:testSetter() (gas: 317480) +MetadataManagerTest:testSetter() (gas: 317194) MintBurn:testFailBurnAll(address,uint256) (runs: 256, μ: 167810, ~: 223832) MintBurn:testFailMintMoreThanMaxSupply(address) (runs: 256, μ: 93127, ~: 93127) -ModuleFactoryTest:testCreateModule((uint256,uint256,string,string),address,bytes) (runs: 256, μ: 405717, ~: 398133) -ModuleFactoryTest:testCreateModuleFailsIfBeaconsImplementationIsZero((uint256,uint256,string,string),address,bytes) (runs: 256, μ: 1254177, ~: 1254208) -ModuleFactoryTest:testCreateModuleFailsIfMetadataUnregistered((uint256,uint256,string,string),address,bytes) (runs: 256, μ: 16772, ~: 16750) +ModuleFactoryTest:testCreateModule((uint256,uint256,string,string),address,bytes) (runs: 256, μ: 406648, ~: 398068) +ModuleFactoryTest:testCreateModuleFailsIfBeaconsImplementationIsZero((uint256,uint256,string,string),address,bytes) (runs: 256, μ: 1249562, ~: 1249594) +ModuleFactoryTest:testCreateModuleFailsIfMetadataUnregistered((uint256,uint256,string,string),address,bytes) (runs: 256, μ: 16765, ~: 16750) ModuleFactoryTest:testDeploymentInvariants() (gas: 10709) -ModuleFactoryTest:testRegisterMetadata((uint256,uint256,string,string)) (runs: 256, μ: 73945, ~: 73961) +ModuleFactoryTest:testRegisterMetadata((uint256,uint256,string,string)) (runs: 256, μ: 73946, ~: 73961) ModuleFactoryTest:testRegisterMetadataFailsIfAlreadyRegistered() (gas: 208365) ModuleFactoryTest:testRegisterMetadataFailsIfBeaconsImplementationIsZero() (gas: 33633) ModuleFactoryTest:testRegisterMetadataFailsIfMetadataInvalid() (gas: 20331) @@ -118,221 +118,208 @@ ModuleManagerTest:testReinitFails() (gas: 13773) ModuleManagerTest:testRemoveModuleFailsIfCallerNotAuthorized(address) (runs: 256, μ: 90707, ~: 90707) ModuleManagerTest:testRemoveModuleFailsIfNotModule(address) (runs: 256, μ: 22492, ~: 22492) ModuleManagerTest:testRemoveModules(address[]) (runs: 256, μ: 7252102, ~: 6521859) -ModuleUpdateTest:testBeaconUpgrade((uint256,uint256,string,string),address,bytes) (runs: 256, μ: 2906836, ~: 2899146) +ModuleUpdateTest:testBeaconUpgrade((uint256,uint256,string,string),address,bytes) (runs: 256, μ: 2896727, ~: 2889789) ModuleUpdateTest:testDeploymentInvariants() (gas: 10686) -OrchestratorCreation:testCreateNewOrchestrator() (gas: 3551507) -OrchestratorCreation:testManageModulesLiveOnPorposal() (gas: 5376761) -OrchestratorFactoryTest:testCreateOrchestrator(uint256) (runs: 256, μ: 3999697, ~: 3842870) +OrchestratorCreation:testCreateNewOrchestrator() (gas: 3505838) +OrchestratorCreation:testManageModulesLiveOnPorposal() (gas: 5302458) +OrchestratorFactoryTest:testCreateOrchestrator(uint256) (runs: 256, μ: 4229359, ~: 4450276) OrchestratorFactoryTest:testDeploymentInvariants() (gas: 10647) -OrchestratorFactoryTest:testOrchestratorMapping(uint256) (runs: 256, μ: 10083193, ~: 9979944) -OrchestratorFactoryTest:testValidOrchestratorId(uint256,uint256) (runs: 256, μ: 9932949, ~: 10154506) -OrchestratorTest:testExecuteTx(uint256,address[]) (runs: 256, μ: 7153042, ~: 8882617) -OrchestratorTest:testExecuteTxFailsIfCallFails(uint256,address[]) (runs: 256, μ: 7154258, ~: 8883740) -OrchestratorTest:testExecuteTxFailsIfCallerNotAuthorized(uint256,address[]) (runs: 256, μ: 7140243, ~: 8869725) -OrchestratorTest:testInit(uint256,address[]) (runs: 256, μ: 4898554, ~: 4860801) -OrchestratorTest:testReinitFails(uint256,address[]) (runs: 256, μ: 7208565, ~: 8905092) -OrchestratorTest:testSetAuthorizer(uint256,address[]) (runs: 256, μ: 5982993, ~: 5902474) -OrchestratorTest:testSetFundingManager(uint256,address[]) (runs: 256, μ: 5589478, ~: 5558319) -OrchestratorTest:testSetPaymentProcessor(uint256,address[]) (runs: 256, μ: 4357186, ~: 4329008) +OrchestratorFactoryTest:testOrchestratorMapping(uint256) (runs: 256, μ: 10361148, ~: 10584639) +OrchestratorFactoryTest:testValidOrchestratorId(uint256,uint256) (runs: 256, μ: 10497278, ~: 11159241) +OrchestratorTest:testExecuteTx(uint256,address[]) (runs: 256, μ: 7214170, ~: 8883380) +OrchestratorTest:testExecuteTxFailsIfCallFails(uint256,address[]) (runs: 256, μ: 7215381, ~: 8884501) +OrchestratorTest:testExecuteTxFailsIfCallerNotAuthorized(uint256,address[]) (runs: 256, μ: 7200417, ~: 8869537) +OrchestratorTest:testInit(uint256,address[]) (runs: 256, μ: 4959516, ~: 4973894) +OrchestratorTest:testReinitFails(uint256,address[]) (runs: 256, μ: 7139737, ~: 8867351) +OrchestratorTest:testSetAuthorizer(uint256,address[]) (runs: 256, μ: 5880519, ~: 5893033) +OrchestratorTest:testSetFundingManager(uint256,address[]) (runs: 256, μ: 5634225, ~: 5594092) +OrchestratorTest:testSetPaymentProcessor(uint256,address[]) (runs: 256, μ: 4405651, ~: 4369396) OrchestratorTest:testVersion() (gas: 9727) Rebase:testNoRebaseIfMaxSupplyTarget() (gas: 118025) Rebase:testNoRebaseIfZeroSupplyTarget() (gas: 90080) Rebase:testRebaseTables() (gas: 26401914) -RebasingFundingManagerTest:testDeposit(address,uint256) (runs: 256, μ: 233868, ~: 233812) -RebasingFundingManagerTest:testDepositAndSpendFunds(uint256,uint256[]) (runs: 256, μ: 5232630, ~: 656898) -RebasingFundingManagerTest:testDepositSpendUntilEmptyRedepositAndWindDown(uint256,uint256[]) (runs: 256, μ: 6515804, ~: 848463) -RebasingFundingManagerTest:testInit() (gas: 31515) -RebasingFundingManagerTest:testInit2RebasingFundingManager() (gas: 57974) +RebasingFundingManagerTest:testDeposit(address,uint256) (runs: 256, μ: 233905, ~: 233857) +RebasingFundingManagerTest:testDepositAndSpendFunds(uint256,uint256[]) (runs: 256, μ: 5056859, ~: 656788) +RebasingFundingManagerTest:testDepositSpendUntilEmptyRedepositAndWindDown(uint256,uint256[]) (runs: 256, μ: 6940627, ~: 847462) +RebasingFundingManagerTest:testInit() (gas: 31471) +RebasingFundingManagerTest:testInit2RebasingFundingManager() (gas: 57956) RebasingFundingManagerTest:testReinitFails() (gas: 31543) -RebasingFundingManagerTest:testSelfDepositFails(address,uint256) (runs: 256, μ: 248825, ~: 248783) +RebasingFundingManagerTest:testSelfDepositFails(address,uint256) (runs: 256, μ: 248759, ~: 248717) RebasingFundingManagerTest:testTransferOrchestratorToken(address,uint256) (runs: 256, μ: 382, ~: 382) -RebasingFundingManagerTest:testTransferOrchestratorTokenFails(address,address) (runs: 256, μ: 112211, ~: 112359) -RecurringPaymentManagerTest:testAddRecurringPayment(uint256,uint256,uint256,address) (runs: 256, μ: 2378736, ~: 2382987) -RecurringPaymentManagerTest:testAddRecurringPaymentModifierInPosition() (gas: 354925) -RecurringPaymentManagerTest:testGetFutureEpoch(uint256) (runs: 256, μ: 286268, ~: 286160) +RebasingFundingManagerTest:testTransferOrchestratorTokenFails(address,address) (runs: 256, μ: 112403, ~: 112403) +RecurringPaymentManagerTest:testAddRecurringPayment(uint256,uint256,uint256,address) (runs: 256, μ: 2243415, ~: 2118229) +RecurringPaymentManagerTest:testAddRecurringPaymentModifierInPosition() (gas: 350335) +RecurringPaymentManagerTest:testGetFutureEpoch(uint256) (runs: 256, μ: 286241, ~: 286138) RecurringPaymentManagerTest:testGetRecurringPaymentInformationModifierInPosition() (gas: 14545) RecurringPaymentManagerTest:testInit() (gas: 781847) -RecurringPaymentManagerTest:testInit2RecurringPaymentManager() (gas: 109091) +RecurringPaymentManagerTest:testInit2RecurringPaymentManager() (gas: 109161) RecurringPaymentManagerTest:testReinitFails() (gas: 280851) -RecurringPaymentManagerTest:testRemoveRecurringPayment(uint256,uint256) (runs: 256, μ: 6373703, ~: 6493005) -RecurringPaymentManagerTest:testRemoveRecurringPaymentModifierInPosition() (gas: 302650) -RecurringPaymentManagerTest:testTrigger(uint256,address[]) (runs: 256, μ: 21093187, ~: 18124064) -RecurringPaymentManagerTest:testTriggerFor(uint256,address[],uint256,uint256) (runs: 256, μ: 7210612, ~: 7147899) -RecurringPaymentManagerTest:testTriggerForModifierInPosition(uint256) (runs: 256, μ: 593863, ~: 594058) -RecurringPaymentManagerTest:testValidId(uint256,uint256,uint256) (runs: 256, μ: 60978773, ~: 60945726) -RecurringPaymentManagerTest:testValidStartEpoch(uint256,uint256) (runs: 256, μ: 438510, ~: 462141) -RecurringPayments:test_e2e_RecurringPayments(uint256) (runs: 256, μ: 3724231, ~: 3724233) -RegisterModuleAtFactory:test_e2e_RegisterModuleAtModuleFactory() (gas: 2038209) -RoleAuthorizerTest:testAdminCannotModifyRoleIfAdminBurned() (gas: 1509243) -RoleAuthorizerTest:testAdminIgnoresIfRoleIsSelfManaged() (gas: 1482435) -RoleAuthorizerTest:testBurnAdminChangesRoleState() (gas: 253) -RoleAuthorizerTest:testBurnedModuleCorrectlyReturnToManagedState() (gas: 1426583) -RoleAuthorizerTest:testChangeRoleAdminOnModuleRole() (gas: 1490184) -RoleAuthorizerTest:testChangeRoleAdminOnModuleRoleFailsIfNotAdmin() (gas: 1375332) -RoleAuthorizerTest:testGrantAdminRole() (gas: 113865) -RoleAuthorizerTest:testGrantAdminRoleFailsIfNotOwner() (gas: 52415) -RoleAuthorizerTest:testGrantGlobalRole() (gas: 118807) -RoleAuthorizerTest:testGrantGlobalRoleFailsIfNotOwner() (gas: 54976) -RoleAuthorizerTest:testGrantManagerRole(address[]) (runs: 256, μ: 1079354, ~: 1165259) -RoleAuthorizerTest:testGrantManagerRoleFailsIfNotOwner(address[]) (runs: 256, μ: 766013, ~: 825612) -RoleAuthorizerTest:testGrantOwnerRole(address[]) (runs: 256, μ: 1086756, ~: 1134940) -RoleAuthorizerTest:testGrantRoleFromModule() (gas: 1437188) -RoleAuthorizerTest:testGrantRoleFromModuleFailsIfCalledByNonModule() (gas: 1349038) -RoleAuthorizerTest:testGrantRoleFromModuleFailsIfModuleNotInOrchestrator() (gas: 1319241) -RoleAuthorizerTest:testGrantRoleFromModuleFailsIfModuleNotSelfManaged() (gas: 1329908) -RoleAuthorizerTest:testGrantRoleFromModuleIdempotence() (gas: 1438319) -RoleAuthorizerTest:testInit2RoleAuthorizer() (gas: 57923) -RoleAuthorizerTest:testInitWithInitialOwner(address) (runs: 256, μ: 2919027, ~: 2919027) -RoleAuthorizerTest:testInitWithoutInitialOwners() (gas: 2882527) -RoleAuthorizerTest:testModifyRoleByAdminFailsIfAdminBurned() (gas: 1534950) -RoleAuthorizerTest:testModuleOnlyUsesOrchestratorRolesWhenNotSelfManaged() (gas: 1426563) -RoleAuthorizerTest:testModuleOnlyUsesOwnRolesWhenSelfManaged() (gas: 1440057) -RoleAuthorizerTest:testModuleReturnToManagedMode() (gas: 231) -RoleAuthorizerTest:testReinitFails() (gas: 1541157) -RoleAuthorizerTest:testRemoveLastOwnerFails() (gas: 32354) -RoleAuthorizerTest:testRevokeGlobalRole() (gas: 97391) -RoleAuthorizerTest:testRevokeGlobalRoleFailsIfNotOwner() (gas: 152592) -RoleAuthorizerTest:testRevokeManagerRole(address[]) (runs: 256, μ: 921244, ~: 1000532) -RoleAuthorizerTest:testRevokeManagerRoleFailsIfNotOwner(address[]) (runs: 256, μ: 766270, ~: 825888) -RoleAuthorizerTest:testRevokeOwnerRole() (gas: 98472) -RoleAuthorizerTest:testRevokeRoleFromModule() (gas: 1370023) -RoleAuthorizerTest:testRevokeRoleFromModuleFailsIfCalledByNonModule() (gas: 1349046) -RoleAuthorizerTest:testRevokeRoleFromModuleFailsIfModuleNotInOrchestrator() (gas: 1321311) -RoleAuthorizerTest:testRevokeRoleFromModuleFailsIfModuleNotSelfManaged() (gas: 1331945) -RoleAuthorizerTest:testRevokeRoleFromModuleIdempotence() (gas: 1354143) -RoleAuthorizerTest:testtoggleModuleSelfManagement() (gas: 1323826) -SimplePaymentProcessorTest:testCancelPaymentsFailsWhenCalledByNonModule(address) (runs: 256, μ: 32806, ~: 32816) -SimplePaymentProcessorTest:testCancelPaymentsFailsWhenCalledOnOtherClient(address) (runs: 256, μ: 2303677, ~: 2303677) +RecurringPaymentManagerTest:testRemoveRecurringPayment(uint256,uint256) (runs: 256, μ: 6329564, ~: 6462062) +RecurringPaymentManagerTest:testRemoveRecurringPaymentModifierInPosition() (gas: 299725) +RecurringPaymentManagerTest:testTrigger(uint256,address[]) (runs: 256, μ: 21560606, ~: 18663371) +RecurringPaymentManagerTest:testTriggerFor(uint256,address[],uint256,uint256) (runs: 256, μ: 7176903, ~: 7145248) +RecurringPaymentManagerTest:testTriggerForModifierInPosition(uint256) (runs: 256, μ: 590668, ~: 590882) +RecurringPaymentManagerTest:testValidId(uint256,uint256,uint256) (runs: 256, μ: 57457266, ~: 54311315) +RecurringPaymentManagerTest:testValidStartEpoch(uint256,uint256) (runs: 256, μ: 436534, ~: 459553) +RecurringPayments:test_e2e_RecurringPayments(uint256) (runs: 256, μ: 3721981, ~: 3721970) +RegisterModuleAtFactory:test_e2e_RegisterModuleAtModuleFactory() (gas: 2033595) +RoleAuthorizerTest:testAdminCannotModifyRoleIfAdminBurned() (gas: 1476959) +RoleAuthorizerTest:testBurnAdminChangesRoleState() (gas: 231) +RoleAuthorizerTest:testChangeRoleAdminOnModuleRole() (gas: 1457766) +RoleAuthorizerTest:testChangeRoleAdminOnModuleRoleFailsIfNotAdmin() (gas: 1342941) +RoleAuthorizerTest:testGrantAdminRole() (gas: 113912) +RoleAuthorizerTest:testGrantAdminRoleFailsIfNotOwner() (gas: 52513) +RoleAuthorizerTest:testGrantGlobalRole() (gas: 116633) +RoleAuthorizerTest:testGrantGlobalRoleFailsIfNotOwner() (gas: 52829) +RoleAuthorizerTest:testGrantManagerRole(address[]) (runs: 256, μ: 1063461, ~: 1165064) +RoleAuthorizerTest:testGrantManagerRoleFailsIfNotOwner(address[]) (runs: 256, μ: 768151, ~: 825495) +RoleAuthorizerTest:testGrantOwnerRole(address[]) (runs: 256, μ: 1084829, ~: 1182213) +RoleAuthorizerTest:testGrantRoleFromModule() (gas: 1404624) +RoleAuthorizerTest:testGrantRoleFromModuleFailsIfCalledByNonModule() (gas: 1316676) +RoleAuthorizerTest:testGrantRoleFromModuleFailsIfModuleNotInOrchestrator() (gas: 1287682) +RoleAuthorizerTest:testGrantRoleFromModuleIdempotence() (gas: 1405597) +RoleAuthorizerTest:testInit2RoleAuthorizer() (gas: 57946) +RoleAuthorizerTest:testInitWithInitialOwner(address) (runs: 256, μ: 2662619, ~: 2662619) +RoleAuthorizerTest:testInitWithoutInitialOwners() (gas: 2627170) +RoleAuthorizerTest:testModifyRoleByAdminFailsIfAdminBurned() (gas: 1502753) +RoleAuthorizerTest:testReinitFails() (gas: 1648509) +RoleAuthorizerTest:testRemoveLastOwnerFails() (gas: 29526) +RoleAuthorizerTest:testRevokeGlobalRole() (gas: 95342) +RoleAuthorizerTest:testRevokeGlobalRoleFailsIfNotOwner() (gas: 150168) +RoleAuthorizerTest:testRevokeManagerRole(address[]) (runs: 256, μ: 920463, ~: 997992) +RoleAuthorizerTest:testRevokeManagerRoleFailsIfNotOwner(address[]) (runs: 256, μ: 767909, ~: 825232) +RoleAuthorizerTest:testRevokeOwnerRole() (gas: 95943) +RoleAuthorizerTest:testRevokeRoleFromModule() (gas: 1336995) +RoleAuthorizerTest:testRevokeRoleFromModuleFailsIfCalledByNonModule() (gas: 1316656) +RoleAuthorizerTest:testRevokeRoleFromModuleFailsIfModuleNotInOrchestrator() (gas: 1289671) +RoleAuthorizerTest:testRevokeRoleFromModuleIdempotence() (gas: 1321126) +SimplePaymentProcessorTest:testCancelPaymentsFailsWhenCalledByNonModule(address) (runs: 256, μ: 32828, ~: 32838) +SimplePaymentProcessorTest:testCancelPaymentsFailsWhenCalledOnOtherClient(address) (runs: 256, μ: 2299092, ~: 2299092) SimplePaymentProcessorTest:testInit() (gas: 20668) -SimplePaymentProcessorTest:testInit2SimplePaymentProcessor() (gas: 57757) -SimplePaymentProcessorTest:testProcessPayments(address,uint256) (runs: 256, μ: 234217, ~: 234280) +SimplePaymentProcessorTest:testInit2SimplePaymentProcessor() (gas: 57894) +SimplePaymentProcessorTest:testProcessPayments(address,uint256) (runs: 256, μ: 234198, ~: 234260) SimplePaymentProcessorTest:testProcessPaymentsFailsWhenCalledByNonModule(address) (runs: 256, μ: 32850, ~: 32860) -SimplePaymentProcessorTest:testProcessPaymentsFailsWhenCalledOnOtherClient(address) (runs: 256, μ: 2303686, ~: 2303686) +SimplePaymentProcessorTest:testProcessPaymentsFailsWhenCalledOnOtherClient(address) (runs: 256, μ: 2299079, ~: 2299079) SimplePaymentProcessorTest:testReinitFails() (gas: 31449) SimulateTransferPrecision:testSimulation() (gas: 3718) -SingleVoteGovernorLifecycle:test_e2e_SingleVoteGovernorLifecycle() (gas: 3900876) -SingleVoteGovernorTest:testAbstain(address[]) (runs: 256, μ: 8811401, ~: 8178529) -SingleVoteGovernorTest:testAbstainUnauthorized(address[]) (runs: 256, μ: 884088, ~: 876479) -SingleVoteGovernorTest:testAddVoters(address[]) (runs: 256, μ: 1207306, ~: 1191454) -SingleVoteGovernorTest:testCastInvalidVote(uint8) (runs: 256, μ: 199963, ~: 199963) -SingleVoteGovernorTest:testCreateVote() (gas: 850170) -SingleVoteGovernorTest:testCreateVoteWithRecentlyAuthorizedAddress(address[]) (runs: 256, μ: 11608604, ~: 11465472) -SingleVoteGovernorTest:testDoubleExecution() (gas: 367687) -SingleVoteGovernorTest:testDoubleVoting(address[]) (runs: 256, μ: 8168145, ~: 7857725) -SingleVoteGovernorTest:testExecuteFailedVote() (gas: 258986) +SingleVoteGovernorLifecycle:test_e2e_SingleVoteGovernorLifecycle() (gas: 3828119) +SingleVoteGovernorTest:testAbstain(address[]) (runs: 256, μ: 8951529, ~: 8399001) +SingleVoteGovernorTest:testAbstainUnauthorized(address[]) (runs: 256, μ: 868651, ~: 840686) +SingleVoteGovernorTest:testAddVoters(address[]) (runs: 256, μ: 1201433, ~: 1190618) +SingleVoteGovernorTest:testCastInvalidVote(uint8) (runs: 256, μ: 199933, ~: 199933) +SingleVoteGovernorTest:testCreateVote() (gas: 850104) +SingleVoteGovernorTest:testCreateVoteWithRecentlyAuthorizedAddress(address[]) (runs: 256, μ: 11652293, ~: 11462356) +SingleVoteGovernorTest:testDoubleExecution() (gas: 367597) +SingleVoteGovernorTest:testDoubleVoting(address[]) (runs: 256, μ: 8272674, ~: 8064702) +SingleVoteGovernorTest:testExecuteFailedVote() (gas: 258956) SingleVoteGovernorTest:testExecuteInexistentVote(uint256) (runs: 256, μ: 13353, ~: 13353) -SingleVoteGovernorTest:testExecuteWhileVotingOpen() (gas: 276436) +SingleVoteGovernorTest:testExecuteWhileVotingOpen() (gas: 276376) SingleVoteGovernorTest:testGetThreshold() (gas: 10278) SingleVoteGovernorTest:testGetVoteDuration() (gas: 10254) -SingleVoteGovernorTest:testGovernanceThresholdChange() (gas: 367446) -SingleVoteGovernorTest:testGovernanceVoteDurationChange() (gas: 365285) -SingleVoteGovernorTest:testInit() (gas: 64675) -SingleVoteGovernorTest:testInit2SingleVoteGovernor() (gas: 76866) -SingleVoteGovernorTest:testInitWithDuplicateInitialVotersFails(address[],uint8) (runs: 256, μ: 3170390, ~: 3168778) -SingleVoteGovernorTest:testInitWithInitialVoters(address[]) (runs: 256, μ: 3552491, ~: 3532035) -SingleVoteGovernorTest:testInitWithInvalidInitialVotersFails() (gas: 2892040) +SingleVoteGovernorTest:testGovernanceThresholdChange() (gas: 367334) +SingleVoteGovernorTest:testGovernanceVoteDurationChange() (gas: 365195) +SingleVoteGovernorTest:testInit() (gas: 62213) +SingleVoteGovernorTest:testInit2SingleVoteGovernor() (gas: 76936) +SingleVoteGovernorTest:testInitWithDuplicateInitialVotersFails(address[],uint8) (runs: 256, μ: 3176054, ~: 3166874) +SingleVoteGovernorTest:testInitWithInitialVoters(address[]) (runs: 256, μ: 3526605, ~: 3488885) +SingleVoteGovernorTest:testInitWithInvalidInitialVotersFails() (gas: 2878054) SingleVoteGovernorTest:testMotionSetInvalidVoteDuration() (gas: 18203) -SingleVoteGovernorTest:testMotionSetThreshold() (gas: 20733) +SingleVoteGovernorTest:testMotionSetThreshold() (gas: 20711) SingleVoteGovernorTest:testMotionSetVoteDuration() (gas: 18595) -SingleVoteGovernorTest:testOnlyGovernanceIsAuthorized(address) (runs: 256, μ: 31216, ~: 31216) -SingleVoteGovernorTest:testReinitFails() (gas: 1544926) +SingleVoteGovernorTest:testOnlyGovernanceIsAuthorized(address) (runs: 256, μ: 33097, ~: 33097) +SingleVoteGovernorTest:testReinitFails() (gas: 1656758) SingleVoteGovernorTest:testRemoveTooManyVoters() (gas: 22418) -SingleVoteGovernorTest:testRemoveUntilVoterListEmpty() (gas: 28199) -SingleVoteGovernorTest:testRemoveVoter(address[]) (runs: 256, μ: 7526403, ~: 7632636) -SingleVoteGovernorTest:testSetUnreachableThreshold(uint256) (runs: 256, μ: 15070, ~: 15070) -SingleVoteGovernorTest:testUnauthorizedGovernanceVoteDurationChange(address[]) (runs: 256, μ: 7805067, ~: 7915236) -SingleVoteGovernorTest:testUnauthorizedThresholdChange(address[]) (runs: 256, μ: 7805760, ~: 7915939) -SingleVoteGovernorTest:testUnauthorizedVoteCreation(address[]) (runs: 256, μ: 808108, ~: 787147) -SingleVoteGovernorTest:testUnauthorizedVoterAddition(address[]) (runs: 256, μ: 7810313, ~: 7920556) -SingleVoteGovernorTest:testUnauthorizedVoterRemoval(address[]) (runs: 256, μ: 7810311, ~: 7920555) -SingleVoteGovernorTest:testVoteAgainst(address[]) (runs: 256, μ: 8964131, ~: 8580706) -SingleVoteGovernorTest:testVoteAgainstUnauthorized(address[]) (runs: 256, μ: 883831, ~: 876225) -SingleVoteGovernorTest:testVoteExecution() (gas: 365307) -SingleVoteGovernorTest:testVoteInFavor(address[]) (runs: 256, μ: 8941311, ~: 8580440) -SingleVoteGovernorTest:testVoteInFavorUnauthorized(address[]) (runs: 256, μ: 884088, ~: 876479) -SingleVoteGovernorTest:testVoteOnExpired(uint256[]) (runs: 256, μ: 1445154, ~: 1468712) -SingleVoteGovernorTest:testVoteOnUnexistingID(uint160[]) (runs: 256, μ: 586791, ~: 420526) -StreamingPaymentProcessorTest:testBlockedAddressCanClaimLater() (gas: 476312) -StreamingPaymentProcessorTest:testCancelPaymentsFailsWhenCalledByNonModule(address) (runs: 256, μ: 32882, ~: 32882) -StreamingPaymentProcessorTest:testCancelPaymentsFailsWhenCalledOnOtherClient(address) (runs: 256, μ: 2303677, ~: 2303677) -StreamingPaymentProcessorTest:testCancelRunningPayments(address[],uint128[],uint64[]) (runs: 256, μ: 10704002, ~: 7786160) -StreamingPaymentProcessorTest:testFalseReturningTokenTransfers() (gas: 472459) -StreamingPaymentProcessorTest:testInit() (gas: 21431) -StreamingPaymentProcessorTest:testInit2StreamingPaymentProcessor() (gas: 57844) -StreamingPaymentProcessorTest:testProcessPaymentsFailsWhenCalledOnOtherClient(address) (runs: 256, μ: 2303738, ~: 2303738) -StreamingPaymentProcessorTest:testProcessPaymentsWorksForDueTimeThatIsPlacedBeforeStartTime(address[],uint256[]) (runs: 256, μ: 6197767, ~: 5848984) +SingleVoteGovernorTest:testRemoveUntilVoterListEmpty() (gas: 28181) +SingleVoteGovernorTest:testRemoveVoter(address[]) (runs: 256, μ: 7281132, ~: 7062431) +SingleVoteGovernorTest:testSetUnreachableThreshold(uint256) (runs: 256, μ: 15048, ~: 15048) +SingleVoteGovernorTest:testUnauthorizedGovernanceVoteDurationChange(address[]) (runs: 256, μ: 7551643, ~: 7324785) +SingleVoteGovernorTest:testUnauthorizedThresholdChange(address[]) (runs: 256, μ: 7551895, ~: 7325030) +SingleVoteGovernorTest:testUnauthorizedVoteCreation(address[]) (runs: 256, μ: 807402, ~: 786729) +SingleVoteGovernorTest:testUnauthorizedVoterAddition(address[]) (runs: 256, μ: 7556720, ~: 7329710) +SingleVoteGovernorTest:testUnauthorizedVoterRemoval(address[]) (runs: 256, μ: 7556718, ~: 7329708) +SingleVoteGovernorTest:testVoteAgainst(address[]) (runs: 256, μ: 8926678, ~: 8578046) +SingleVoteGovernorTest:testVoteAgainstUnauthorized(address[]) (runs: 256, μ: 868399, ~: 840443) +SingleVoteGovernorTest:testVoteExecution() (gas: 365217) +SingleVoteGovernorTest:testVoteInFavor(address[]) (runs: 256, μ: 8905600, ~: 8355909) +SingleVoteGovernorTest:testVoteInFavorUnauthorized(address[]) (runs: 256, μ: 868651, ~: 840686) +SingleVoteGovernorTest:testVoteOnExpired(uint256[]) (runs: 256, μ: 1434058, ~: 1457327) +SingleVoteGovernorTest:testVoteOnUnexistingID(uint160[]) (runs: 256, μ: 544076, ~: 410496) +StreamingPaymentProcessorTest:testBlockedAddressCanClaimLater() (gas: 476241) +StreamingPaymentProcessorTest:testCancelPaymentsFailsWhenCalledByNonModule(address) (runs: 256, μ: 32904, ~: 32904) +StreamingPaymentProcessorTest:testCancelPaymentsFailsWhenCalledOnOtherClient(address) (runs: 256, μ: 2299092, ~: 2299092) +StreamingPaymentProcessorTest:testCancelRunningPayments(address[],uint128[],uint64[]) (runs: 256, μ: 10708969, ~: 7464512) +StreamingPaymentProcessorTest:testFalseReturningTokenTransfers() (gas: 472388) +StreamingPaymentProcessorTest:testInit() (gas: 21409) +StreamingPaymentProcessorTest:testInit2StreamingPaymentProcessor() (gas: 57914) +StreamingPaymentProcessorTest:testProcessPaymentsFailsWhenCalledOnOtherClient(address) (runs: 256, μ: 2299131, ~: 2299131) +StreamingPaymentProcessorTest:testProcessPaymentsWorksForDueTimeThatIsPlacedBeforeStartTime(address[],uint256[]) (runs: 256, μ: 6251554, ~: 5868448) StreamingPaymentProcessorTest:testReinitFails() (gas: 31498) -StreamingPaymentProcessorTest:testStreamingCalculation(address[],uint128[]) (runs: 256, μ: 16055487, ~: 15343756) -StreamingPaymentProcessorTest:testUpdateFinishedPayments(address[],uint128[],uint64[]) (runs: 256, μ: 20101487, ~: 13540399) -StreamingPaymentProcessorTest:test_cancelRunningPayments_allCreatedOrdersGetCancelled(address[],uint128[]) (runs: 256, μ: 12813565, ~: 8554715) -StreamingPaymentProcessorTest:test_claimVestedAmounts_fullVesting(address[],uint128[],uint64[]) (runs: 256, μ: 10120403, ~: 7000892) -StreamingPaymentProcessorTest:test_processPayments(address[],uint128[],uint64[]) (runs: 256, μ: 8227094, ~: 6313645) -StreamingPaymentProcessorTest:test_processPayments_discardsInvalidPaymentOrders() (gas: 539462) +StreamingPaymentProcessorTest:testStreamingCalculation(address[],uint128[]) (runs: 256, μ: 15803533, ~: 15334219) +StreamingPaymentProcessorTest:testUpdateFinishedPayments(address[],uint128[],uint64[]) (runs: 256, μ: 17793966, ~: 13542916) +StreamingPaymentProcessorTest:test_cancelRunningPayments_allCreatedOrdersGetCancelled(address[],uint128[]) (runs: 256, μ: 13252893, ~: 9213976) +StreamingPaymentProcessorTest:test_claimVestedAmounts_fullVesting(address[],uint128[],uint64[]) (runs: 256, μ: 9913617, ~: 6674393) +StreamingPaymentProcessorTest:test_processPayments(address[],uint128[],uint64[]) (runs: 256, μ: 8644606, ~: 6569421) +StreamingPaymentProcessorTest:test_processPayments_discardsInvalidPaymentOrders() (gas: 539358) StreamingPaymentProcessorTest:test_processPayments_failsWhenCalledByNonModule(address) (runs: 256, μ: 32868, ~: 32868) -StreamingPaymentProcessorTest:test_processPayments_paymentOrdersAreNotOverwritten(uint256,uint256,uint256,uint256) (runs: 256, μ: 1460672, ~: 1459681) -StreamingPaymentProcessorTest:test_processPayments_vestingInfoGetsDeletedPostFullPayment(address[],uint128[],uint64[]) (runs: 256, μ: 9955992, ~: 6885634) -StreamingPaymentProcessorTest:test_removePaymentAndClaimForSpecificWalletId(uint256,uint256,uint256,uint256) (runs: 256, μ: 1667402, ~: 1667586) -StreamingPaymentProcessorTest:test_removePaymentForSpecificWalletId_halfVestingDoneMultipleOrdersForSingleBeneficiary(uint256,uint256,uint256,uint256) (runs: 256, μ: 1567955, ~: 1568124) -StreamingPaymentsLifecycle:test_e2e_StreamingPaymentsLifecycleAdminFunctions() (gas: 4043140) -StreamingPaymentsLifecycle:test_e2e_StreamingPaymentsLifecycleUserFunctions() (gas: 3169250) -TokenGatedRoleAuthorizerTest:testAdminCannotAddNonTokenWhenTokenGated() (gas: 289644) -TokenGatedRoleAuthorizerTest:testCanAddTokenWhenTokenGated() (gas: 336519) -TokenGatedRoleAuthorizerTest:testCannotAddNonTokenWhenTokenGated() (gas: 183351) -TokenGatedRoleAuthorizerTest:testFuzzNFTAuthorization(address[],bool[]) (runs: 256, μ: 739121, ~: 619748) -TokenGatedRoleAuthorizerTest:testFuzzTokenAuthorization(uint256,address[],uint256[]) (runs: 256, μ: 2567037, ~: 2227068) -TokenGatedRoleAuthorizerTest:testMakeRoleTokenGated() (gas: 339144) -TokenGatedRoleAuthorizerTest:testMakingFunctionTokenGatedFailsIfAlreadyInUse() (gas: 126731) -TokenGatedRoleAuthorizerTest:testSetThreshold() (gas: 181280) -TokenGatedRoleAuthorizerTest:testSetThresholdFailsIfInvalid() (gas: 153565) -TokenGatedRoleAuthorizerTest:testSetThresholdFailsIfNotTokenGated() (gas: 237759) -TokenGatedRoleAuthorizerTest:testSetThresholdFromAdminFailsIfInvalid() (gas: 291234) -TokenGatedRoleAuthorizerTest:testSetTokenGatedFailsIfRoleAlreadyInUse() (gas: 218657) -TokenGatedRoleAuthorizerTest:testSetTokenGatingByAdmin() (gas: 149645) -TokenGatedRoleAuthorizerUpstreamTests:testAdminCannotModifyRoleIfAdminBurned() (gas: 1511592) -TokenGatedRoleAuthorizerUpstreamTests:testAdminIgnoresIfRoleIsSelfManaged() (gas: 1487258) -TokenGatedRoleAuthorizerUpstreamTests:testBurnAdminChangesRoleState() (gas: 253) -TokenGatedRoleAuthorizerUpstreamTests:testBurnedModuleCorrectlyReturnToManagedState() (gas: 1429206) -TokenGatedRoleAuthorizerUpstreamTests:testChangeRoleAdminOnModuleRole() (gas: 1494804) -TokenGatedRoleAuthorizerUpstreamTests:testChangeRoleAdminOnModuleRoleFailsIfNotAdmin() (gas: 1375478) -TokenGatedRoleAuthorizerUpstreamTests:testGrantAdminRole() (gas: 116091) -TokenGatedRoleAuthorizerUpstreamTests:testGrantAdminRoleFailsIfNotOwner() (gas: 52415) -TokenGatedRoleAuthorizerUpstreamTests:testGrantGlobalRole() (gas: 121056) -TokenGatedRoleAuthorizerUpstreamTests:testGrantGlobalRoleFailsIfNotOwner() (gas: 54999) -TokenGatedRoleAuthorizerUpstreamTests:testGrantManagerRole(address[]) (runs: 256, μ: 1085932, ~: 1170032) -TokenGatedRoleAuthorizerUpstreamTests:testGrantManagerRoleFailsIfNotOwner(address[]) (runs: 256, μ: 766235, ~: 795531) -TokenGatedRoleAuthorizerUpstreamTests:testGrantOwnerRole(address[]) (runs: 256, μ: 1100252, ~: 1191945) -TokenGatedRoleAuthorizerUpstreamTests:testGrantRoleFromModule() (gas: 1439620) -TokenGatedRoleAuthorizerUpstreamTests:testGrantRoleFromModuleFailsIfCalledByNonModule() (gas: 1349199) -TokenGatedRoleAuthorizerUpstreamTests:testGrantRoleFromModuleFailsIfModuleNotInOrchestrator() (gas: 1319402) -TokenGatedRoleAuthorizerUpstreamTests:testGrantRoleFromModuleFailsIfModuleNotSelfManaged() (gas: 1330085) -TokenGatedRoleAuthorizerUpstreamTests:testGrantRoleFromModuleIdempotence() (gas: 1440992) -TokenGatedRoleAuthorizerUpstreamTests:testInit2RoleAuthorizer() (gas: 57895) -TokenGatedRoleAuthorizerUpstreamTests:testInitWithInitialOwner(address) (runs: 256, μ: 2919027, ~: 2919027) -TokenGatedRoleAuthorizerUpstreamTests:testInitWithoutInitialOwners() (gas: 2882527) -TokenGatedRoleAuthorizerUpstreamTests:testModifyRoleByAdminFailsIfAdminBurned() (gas: 1539592) -TokenGatedRoleAuthorizerUpstreamTests:testModuleOnlyUsesOrchestratorRolesWhenNotSelfManaged() (gas: 1429186) -TokenGatedRoleAuthorizerUpstreamTests:testModuleOnlyUsesOwnRolesWhenSelfManaged() (gas: 1442817) -TokenGatedRoleAuthorizerUpstreamTests:testModuleReturnToManagedMode() (gas: 231) -TokenGatedRoleAuthorizerUpstreamTests:testReinitFails() (gas: 1541148) -TokenGatedRoleAuthorizerUpstreamTests:testRemoveLastOwnerFails() (gas: 32354) -TokenGatedRoleAuthorizerUpstreamTests:testRevokeGlobalRole() (gas: 99172) -TokenGatedRoleAuthorizerUpstreamTests:testRevokeGlobalRoleFailsIfNotOwner() (gas: 154819) -TokenGatedRoleAuthorizerUpstreamTests:testRevokeManagerRole(address[]) (runs: 256, μ: 925925, ~: 1004350) -TokenGatedRoleAuthorizerUpstreamTests:testRevokeManagerRoleFailsIfNotOwner(address[]) (runs: 256, μ: 766269, ~: 795566) -TokenGatedRoleAuthorizerUpstreamTests:testRevokeOwnerRole() (gas: 100270) -TokenGatedRoleAuthorizerUpstreamTests:testRevokeRoleFromModule() (gas: 1372494) -TokenGatedRoleAuthorizerUpstreamTests:testRevokeRoleFromModuleFailsIfCalledByNonModule() (gas: 1349152) -TokenGatedRoleAuthorizerUpstreamTests:testRevokeRoleFromModuleFailsIfModuleNotInOrchestrator() (gas: 1321472) -TokenGatedRoleAuthorizerUpstreamTests:testRevokeRoleFromModuleFailsIfModuleNotSelfManaged() (gas: 1332122) -TokenGatedRoleAuthorizerUpstreamTests:testRevokeRoleFromModuleIdempotence() (gas: 1354232) -TokenGatedRoleAuthorizerUpstreamTests:testtoggleModuleSelfManagement() (gas: 1323988) +StreamingPaymentProcessorTest:test_processPayments_paymentOrdersAreNotOverwritten(uint256,uint256,uint256,uint256) (runs: 256, μ: 1460339, ~: 1460788) +StreamingPaymentProcessorTest:test_processPayments_vestingInfoGetsDeletedPostFullPayment(address[],uint128[],uint64[]) (runs: 256, μ: 9753138, ~: 6564922) +StreamingPaymentProcessorTest:test_removePaymentAndClaimForSpecificWalletId(uint256,uint256,uint256,uint256) (runs: 256, μ: 1665289, ~: 1665463) +StreamingPaymentProcessorTest:test_removePaymentForSpecificWalletId_halfVestingDoneMultipleOrdersForSingleBeneficiary(uint256,uint256,uint256,uint256) (runs: 256, μ: 1565882, ~: 1566037) +StreamingPaymentsLifecycle:test_e2e_StreamingPaymentsLifecycleAdminFunctions() (gas: 4039030) +StreamingPaymentsLifecycle:test_e2e_StreamingPaymentsLifecycleUserFunctions() (gas: 3166488) +TokenGatedRoleAuthorizerTest:testAdminCannotAddNonTokenWhenTokenGated() (gas: 288861) +TokenGatedRoleAuthorizerTest:testCanAddTokenWhenTokenGated() (gas: 331325) +TokenGatedRoleAuthorizerTest:testCannotAddNonTokenWhenTokenGated() (gas: 179743) +TokenGatedRoleAuthorizerTest:testFuzzNFTAuthorization(address[],bool[]) (runs: 256, μ: 736348, ~: 616985) +TokenGatedRoleAuthorizerTest:testFuzzTokenAuthorization(uint256,address[],uint256[]) (runs: 256, μ: 2563872, ~: 2241005) +TokenGatedRoleAuthorizerTest:testMakeRoleTokenGated() (gas: 333862) +TokenGatedRoleAuthorizerTest:testMakingFunctionTokenGatedFailsIfAlreadyInUse() (gas: 122938) +TokenGatedRoleAuthorizerTest:testSetThreshold() (gas: 177673) +TokenGatedRoleAuthorizerTest:testSetThresholdFailsIfInvalid() (gas: 151389) +TokenGatedRoleAuthorizerTest:testSetThresholdFailsIfNotTokenGated() (gas: 238819) +TokenGatedRoleAuthorizerTest:testSetThresholdFromAdminFailsIfInvalid() (gas: 290735) +TokenGatedRoleAuthorizerTest:testSetThresholdFromModule() (gas: 183132) +TokenGatedRoleAuthorizerTest:testSetThresholdFromModuleFailsIfInvalid() (gas: 178492) +TokenGatedRoleAuthorizerTest:testSetThresholdFromModuleFailsIfNotTokenGated() (gas: 138016) +TokenGatedRoleAuthorizerTest:testSetTokenGatedFailsIfRoleAlreadyInUse() (gas: 218866) +TokenGatedRoleAuthorizerTest:testSetTokenGatingByAdmin() (gas: 139350) +TokenGatedRoleAuthorizerUpstreamTests:testAdminCannotModifyRoleIfAdminBurned() (gas: 1489414) +TokenGatedRoleAuthorizerUpstreamTests:testBurnAdminChangesRoleState() (gas: 231) +TokenGatedRoleAuthorizerUpstreamTests:testChangeRoleAdminOnModuleRole() (gas: 1467243) +TokenGatedRoleAuthorizerUpstreamTests:testChangeRoleAdminOnModuleRoleFailsIfNotAdmin() (gas: 1347554) +TokenGatedRoleAuthorizerUpstreamTests:testGrantAdminRole() (gas: 118874) +TokenGatedRoleAuthorizerUpstreamTests:testGrantAdminRoleFailsIfNotOwner() (gas: 56988) +TokenGatedRoleAuthorizerUpstreamTests:testGrantGlobalRole() (gas: 121535) +TokenGatedRoleAuthorizerUpstreamTests:testGrantGlobalRoleFailsIfNotOwner() (gas: 57241) +TokenGatedRoleAuthorizerUpstreamTests:testGrantManagerRole(address[]) (runs: 256, μ: 1084795, ~: 1179646) +TokenGatedRoleAuthorizerUpstreamTests:testGrantManagerRoleFailsIfNotOwner(address[]) (runs: 256, μ: 775353, ~: 835682) +TokenGatedRoleAuthorizerUpstreamTests:testGrantOwnerRole(address[]) (runs: 256, μ: 1102904, ~: 1195919) +TokenGatedRoleAuthorizerUpstreamTests:testGrantRoleFromModule() (gas: 1409868) +TokenGatedRoleAuthorizerUpstreamTests:testGrantRoleFromModuleFailsIfCalledByNonModule() (gas: 1321235) +TokenGatedRoleAuthorizerUpstreamTests:testGrantRoleFromModuleFailsIfModuleNotInOrchestrator() (gas: 1292478) +TokenGatedRoleAuthorizerUpstreamTests:testGrantRoleFromModuleIdempotence() (gas: 1411152) +TokenGatedRoleAuthorizerUpstreamTests:testInit2RoleAuthorizer() (gas: 57918) +TokenGatedRoleAuthorizerUpstreamTests:testInitWithInitialOwner(address) (runs: 256, μ: 2662619, ~: 2662619) +TokenGatedRoleAuthorizerUpstreamTests:testInitWithoutInitialOwners() (gas: 2627170) +TokenGatedRoleAuthorizerUpstreamTests:testModifyRoleByAdminFailsIfAdminBurned() (gas: 1518921) +TokenGatedRoleAuthorizerUpstreamTests:testReinitFails() (gas: 1651004) +TokenGatedRoleAuthorizerUpstreamTests:testRemoveLastOwnerFails() (gas: 34180) +TokenGatedRoleAuthorizerUpstreamTests:testRevokeGlobalRole() (gas: 99883) +TokenGatedRoleAuthorizerUpstreamTests:testRevokeGlobalRoleFailsIfNotOwner() (gas: 155568) +TokenGatedRoleAuthorizerUpstreamTests:testRevokeManagerRole(address[]) (runs: 256, μ: 929804, ~: 1016258) +TokenGatedRoleAuthorizerUpstreamTests:testRevokeManagerRoleFailsIfNotOwner(address[]) (runs: 256, μ: 775112, ~: 835419) +TokenGatedRoleAuthorizerUpstreamTests:testRevokeOwnerRole() (gas: 99162) +TokenGatedRoleAuthorizerUpstreamTests:testRevokeRoleFromModule() (gas: 1342726) +TokenGatedRoleAuthorizerUpstreamTests:testRevokeRoleFromModuleFailsIfCalledByNonModule() (gas: 1321215) +TokenGatedRoleAuthorizerUpstreamTests:testRevokeRoleFromModuleFailsIfModuleNotInOrchestrator() (gas: 1294467) +TokenGatedRoleAuthorizerUpstreamTests:testRevokeRoleFromModuleIdempotence() (gas: 1326253) VirtualTokenSupplyBaseTest:testAddTokenAmount(uint256) (runs: 256, μ: 14709, ~: 14906) VirtualTokenSupplyBaseTest:testSubTokenAmount(uint256) (runs: 256, μ: 14494, ~: 14746) VirtualTokenSupplyBaseTest:testSubTokenAmountFails(uint256) (runs: 256, μ: 11182, ~: 11182) -baseModuleTest:testGrantModuleRole(uint8,address) (runs: 256, μ: 63902, ~: 63902) -baseModuleTest:testInit() (gas: 50821) -baseModuleTest:testInitFailsForInvalidOrchestrator() (gas: 1289358) -baseModuleTest:testInitFailsForNonInitializerFunction() (gas: 1271312) -baseModuleTest:testInitFailsIfMetadataInvalid() (gas: 1350377) +baseModuleTest:testGrantModuleRole(bytes32,address) (runs: 256, μ: 60300, ~: 60300) +baseModuleTest:testInit() (gas: 50755) +baseModuleTest:testInitFailsForInvalidOrchestrator() (gas: 1284744) +baseModuleTest:testInitFailsForNonInitializerFunction() (gas: 1266698) +baseModuleTest:testInitFailsIfMetadataInvalid() (gas: 1345763) baseModuleTest:testReinitFails() (gas: 33629) -baseModuleTest:testRevokeModuleRole(uint8,address) (runs: 256, μ: 52335, ~: 52331) \ No newline at end of file +baseModuleTest:testRevokeModuleRole(bytes32,address) (runs: 256, μ: 49213, ~: 49172) \ No newline at end of file diff --git a/lcov.info b/lcov.info index 4fc7a7b78..5835a4ca5 100644 --- a/lcov.info +++ b/lcov.info @@ -272,13 +272,13 @@ DA:210,0 DA:211,0 DA:216,0 DA:218,0 -DA:222,0 -DA:224,0 -DA:226,0 -DA:228,0 -DA:230,0 -DA:233,0 -DA:235,0 +DA:223,0 +DA:225,0 +DA:227,0 +DA:229,0 +DA:231,0 +DA:234,0 +DA:236,0 FNF:1 FNH:0 LF:61 @@ -406,51 +406,51 @@ end_of_record TN: SF:src/factories/OrchestratorFactory.sol FN:73,OrchestratorFactory.createOrchestrator -FNDA:13806,OrchestratorFactory.createOrchestrator -DA:80,13806 -DA:83,13806 -DA:86,13806 -DA:93,13806 -DA:100,13806 -DA:107,13806 -DA:108,13806 -DA:109,13806 -DA:110,12806 -DA:117,13806 +FNDA:12940,OrchestratorFactory.createOrchestrator +DA:80,12940 +DA:83,12940 +DA:86,12940 +DA:93,12940 +DA:100,12940 +DA:107,12940 +DA:108,12940 +DA:109,12940 +DA:110,12788 +DA:117,12940 BRDA:117,0,0,- -BRDA:117,0,1,13806 +BRDA:117,0,1,12940 DA:118,0 -DA:122,13806 -DA:134,13806 -DA:135,12806 +DA:122,12940 +DA:134,12940 +DA:135,12788 BRDA:135,1,0,- BRDA:135,1,1,3 DA:136,3 -DA:143,13806 +DA:143,12940 BRDA:143,2,0,- BRDA:143,2,1,- DA:144,0 -DA:148,13806 +DA:148,12940 BRDA:148,3,0,- BRDA:148,3,1,- DA:149,0 -DA:153,13806 +DA:153,12940 BRDA:153,4,0,- BRDA:153,4,1,- DA:155,0 -DA:160,13806 +DA:160,12940 FN:164,OrchestratorFactory.getOrchestratorByID -FNDA:6473,OrchestratorFactory.getOrchestratorByID -DA:170,6254 +FNDA:6667,OrchestratorFactory.getOrchestratorByID +DA:170,6442 FN:173,OrchestratorFactory.getOrchestratorIDCounter FNDA:256,OrchestratorFactory.getOrchestratorIDCounter DA:174,256 FN:177,OrchestratorFactory.decoder -FNDA:108448,OrchestratorFactory.decoder -DA:182,108448 +FNDA:103216,OrchestratorFactory.decoder +DA:182,103216 FN:185,OrchestratorFactory._dependencyInjectionRequired -FNDA:54224,OrchestratorFactory._dependencyInjectionRequired -DA:190,54224 +FNDA:51608,OrchestratorFactory._dependencyInjectionRequired +DA:190,51608 FNF:5 FNH:5 LF:26 @@ -461,8 +461,8 @@ end_of_record TN: SF:src/factories/beacon/Beacon.sol FN:40,Beacon.implementation -FNDA:13322,Beacon.implementation -DA:41,13322 +FNDA:13334,Beacon.implementation +DA:41,13334 FN:51,Beacon.upgradeTo FNDA:260,Beacon.upgradeTo DA:52,4 @@ -488,8 +488,8 @@ end_of_record TN: SF:src/factories/beacon/BeaconProxy.sol FN:41,BeaconProxy._implementation -FNDA:14565,BeaconProxy._implementation -DA:42,14565 +FNDA:14577,BeaconProxy._implementation +DA:42,14577 FNF:1 FNH:1 LF:1 @@ -510,52 +510,28 @@ FNDA:519,RoleAuthorizer.__RoleAuthorizer_init DA:79,519 DA:84,519 DA:86,519 -FN:89,RoleAuthorizer.__RoleAuthorizer_init -FNDA:519,RoleAuthorizer.__RoleAuthorizer_init -DA:98,519 -DA:100,519 -DA:104,519 -DA:109,519 -DA:111,519 -DA:115,519 -DA:117,519 -DA:121,519 -BRDA:121,0,0,517 -BRDA:121,0,1,519 -DA:122,517 -DA:123,517 -FN:133,RoleAuthorizer._revokeRole -FNDA:5496,RoleAuthorizer._revokeRole -DA:139,5494 -FN:149,RoleAuthorizer.isAuthorized -FNDA:55,RoleAuthorizer.isAuthorized -DA:151,55 -FN:155,RoleAuthorizer.isAuthorized -FNDA:1036,RoleAuthorizer.isAuthorized -DA:162,1036 -DA:165,1036 -BRDA:165,1,0,4 -BRDA:165,1,1,1032 -DA:166,4 -DA:168,1032 -DA:170,1036 -FN:174,RoleAuthorizer.generateRoleId -FNDA:2662,RoleAuthorizer.generateRoleId -DA:180,32959 -FN:186,RoleAuthorizer.toggleModuleSelfManagement -FNDA:51,RoleAuthorizer.toggleModuleSelfManagement -DA:187,51 -BRDA:187,2,0,11 -BRDA:187,2,1,40 -DA:188,11 -DA:189,11 -DA:191,40 -DA:192,40 -FN:197,RoleAuthorizer.grantRoleFromModule -FNDA:30,RoleAuthorizer.grantRoleFromModule -DA:202,20 -DA:203,20 -FN:207,RoleAuthorizer.revokeRoleFromModule +DA:90,519 +DA:92,519 +DA:96,519 +BRDA:96,0,0,517 +BRDA:96,0,1,519 +DA:97,517 +DA:98,517 +FN:108,RoleAuthorizer._revokeRole +FNDA:5779,RoleAuthorizer._revokeRole +DA:114,5777 +FN:121,RoleAuthorizer.hasModuleRole +FNDA:26756,RoleAuthorizer.hasModuleRole +DA:128,26756 +DA:129,26756 +FN:133,RoleAuthorizer.generateRoleId +FNDA:595,RoleAuthorizer.generateRoleId +DA:139,28980 +FN:143,RoleAuthorizer.grantRoleFromModule +FNDA:20,RoleAuthorizer.grantRoleFromModule +DA:147,14 +DA:148,14 +FN:152,RoleAuthorizer.revokeRoleFromModule FNDA:9,RoleAuthorizer.revokeRoleFromModule DA:156,7 DA:157,7 @@ -572,83 +548,83 @@ DA:182,6 DA:183,6 FN:187,RoleAuthorizer.revokeGlobalRole FNDA:4,RoleAuthorizer.revokeGlobalRole -DA:248,2 -DA:249,2 -FN:253,RoleAuthorizer.getOwnerRole -FNDA:11537,RoleAuthorizer.getOwnerRole -DA:254,11537 -FN:258,RoleAuthorizer.getManagerRole -FNDA:0,RoleAuthorizer.getManagerRole -DA:259,0 -FNF:15 -FNH:14 -LF:40 -LH:39 -BRF:6 -BRH:6 +DA:191,2 +DA:192,2 +FN:196,RoleAuthorizer.getOwnerRole +FNDA:11434,RoleAuthorizer.getOwnerRole +DA:197,11434 +FN:201,RoleAuthorizer.getManagerRole +FNDA:2048,RoleAuthorizer.getManagerRole +DA:202,2048 +FNF:13 +FNH:13 +LF:29 +LH:29 +BRF:2 +BRH:2 end_of_record TN: SF:src/modules/authorizer/TokenGatedRoleAuthorizer.sol -FN:62,TokenGatedRoleAuthorizer.isAuthorized -FNDA:26583,TokenGatedRoleAuthorizer.isAuthorized -DA:69,26583 -DA:71,26583 -BRDA:71,0,0,26573 -BRDA:71,0,1,4 -DA:72,26577 -DA:74,26577 -BRDA:74,1,0,26573 -BRDA:74,1,1,4 -DA:75,26573 -DA:77,4 -DA:81,6 -DA:82,6 -FN:90,TokenGatedRoleAuthorizer._grantRole -FNDA:8808,TokenGatedRoleAuthorizer._grantRole -DA:95,8808 -BRDA:95,2,0,- -BRDA:95,2,1,521 -DA:96,521 -DA:102,8808 -FN:109,TokenGatedRoleAuthorizer.hasTokenRole -FNDA:26573,TokenGatedRoleAuthorizer.hasTokenRole -DA:114,53146 -DA:116,53146 -DA:117,53146 -DA:118,53146 -DA:119,53146 -DA:122,53146 -DA:135,28902 -FN:139,TokenGatedRoleAuthorizer.getThresholdValue -FNDA:1,TokenGatedRoleAuthorizer.getThresholdValue -DA:144,1 -DA:145,1 -FN:152,TokenGatedRoleAuthorizer.makeRoleTokenGatedFromModule -FNDA:523,TokenGatedRoleAuthorizer.makeRoleTokenGatedFromModule -DA:158,522 -DA:160,522 -DA:161,522 -FN:165,TokenGatedRoleAuthorizer.grantTokenRoleFromModule -FNDA:522,TokenGatedRoleAuthorizer.grantTokenRoleFromModule -DA:170,522 -DA:171,522 -DA:172,522 -FN:179,TokenGatedRoleAuthorizer.setTokenGated +FN:68,TokenGatedRoleAuthorizer.hasRole +FNDA:15852,TokenGatedRoleAuthorizer.hasRole +DA:75,69496 +BRDA:75,0,0,27279 +BRDA:75,0,1,42217 +DA:76,27279 +DA:78,42217 +FN:86,TokenGatedRoleAuthorizer._grantRole +FNDA:8512,TokenGatedRoleAuthorizer._grantRole +DA:91,8512 +BRDA:91,1,0,- +BRDA:91,1,1,523 +DA:92,523 +DA:98,8512 +FN:105,TokenGatedRoleAuthorizer.hasTokenRole +FNDA:26756,TokenGatedRoleAuthorizer.hasTokenRole +DA:111,26756 +FN:115,TokenGatedRoleAuthorizer.getThresholdValue +FNDA:2,TokenGatedRoleAuthorizer.getThresholdValue +DA:120,2 +DA:121,2 +FN:128,TokenGatedRoleAuthorizer.makeRoleTokenGatedFromModule +FNDA:525,TokenGatedRoleAuthorizer.makeRoleTokenGatedFromModule +DA:133,524 +DA:135,524 +DA:136,524 +FN:140,TokenGatedRoleAuthorizer.grantTokenRoleFromModule +FNDA:524,TokenGatedRoleAuthorizer.grantTokenRoleFromModule +DA:145,524 +DA:146,524 +DA:147,524 +FN:151,TokenGatedRoleAuthorizer.setThresholdFromModule +FNDA:3,TokenGatedRoleAuthorizer.setThresholdFromModule +DA:155,3 +DA:156,3 +FN:163,TokenGatedRoleAuthorizer.setTokenGated FNDA:6,TokenGatedRoleAuthorizer.setTokenGated -DA:189,4 -DA:190,4 -FN:194,TokenGatedRoleAuthorizer.setThreshold +DA:168,4 +DA:169,4 +FN:173,TokenGatedRoleAuthorizer.setThreshold FNDA:2,TokenGatedRoleAuthorizer.setThreshold -DA:198,2 -FN:209,TokenGatedRoleAuthorizer._setThreshold +DA:177,2 +FN:188,TokenGatedRoleAuthorizer._setThreshold FNDA:529,TokenGatedRoleAuthorizer._setThreshold -DA:214,523 -DA:215,523 -DA:216,523 -FNF:10 -FNH:10 -LF:29 -LH:29 +DA:193,523 +DA:194,523 +DA:195,523 +FN:201,TokenGatedRoleAuthorizer._hasTokenRole +FNDA:54035,TokenGatedRoleAuthorizer._hasTokenRole +DA:206,54035 +DA:208,54035 +DA:209,53512 +DA:210,53512 +DA:211,53512 +DA:214,53512 +DA:227,29379 +FNF:11 +FNH:11 +LF:30 +LH:30 BRF:4 BRH:3 end_of_record @@ -684,8 +660,8 @@ FN:200,Module.title FNDA:11,Module.title DA:201,11 FN:205,Module.orchestrator -FNDA:75204,Module.orchestrator -DA:206,604077 +FNDA:73689,Module.orchestrator +DA:206,238677 FN:212,Module.grantModuleRole FNDA:516,Module.grantModuleRole DA:216,516 @@ -725,47 +701,47 @@ DA:72,264 DA:74,264 FN:81,RebasingFundingManager.token FNDA:0,RebasingFundingManager.token -DA:82,70903 +DA:82,93211 FN:86,RebasingFundingManager._supplyTarget -FNDA:26500,RebasingFundingManager._supplyTarget -DA:92,26500 +FNDA:34697,RebasingFundingManager._supplyTarget +DA:92,34697 FN:98,RebasingFundingManager.deposit -FNDA:11757,RebasingFundingManager.deposit -DA:99,11757 +FNDA:15277,RebasingFundingManager.deposit +DA:99,15277 FN:102,RebasingFundingManager.depositFor -FNDA:7426,RebasingFundingManager.depositFor -DA:103,7426 +FNDA:9820,RebasingFundingManager.depositFor +DA:103,9820 FN:106,RebasingFundingManager.withdraw -FNDA:3341,RebasingFundingManager.withdraw -DA:107,3341 +FNDA:4508,RebasingFundingManager.withdraw +DA:107,4508 FN:110,RebasingFundingManager.withdrawTo -FNDA:3208,RebasingFundingManager.withdrawTo -DA:111,3208 +FNDA:4324,RebasingFundingManager.withdrawTo +DA:111,4324 FN:117,RebasingFundingManager.transferOrchestratorToken FNDA:772,RebasingFundingManager.transferOrchestratorToken DA:122,514 FN:128,RebasingFundingManager._deposit -FNDA:19183,RebasingFundingManager._deposit -DA:130,19183 +FNDA:25097,RebasingFundingManager._deposit +DA:130,25097 BRDA:130,0,0,256 -BRDA:130,0,1,18927 +BRDA:130,0,1,24841 DA:131,256 -DA:134,18927 +DA:134,24841 BRDA:134,1,0,- -BRDA:134,1,1,18927 +BRDA:134,1,1,24841 DA:135,0 -DA:138,18927 -DA:140,18927 -DA:142,18927 +DA:138,24841 +DA:140,24841 +DA:142,24841 FN:145,RebasingFundingManager._withdraw -FNDA:6549,RebasingFundingManager._withdraw -DA:146,6549 -DA:148,6549 -DA:150,6549 +FNDA:8832,RebasingFundingManager._withdraw +DA:146,8832 +DA:148,8832 +DA:150,8832 FN:153,RebasingFundingManager._transferOrchestratorToken -FNDA:513,RebasingFundingManager._transferOrchestratorToken -DA:154,513 -DA:156,513 +FNDA:514,RebasingFundingManager._transferOrchestratorToken +DA:154,514 +DA:156,514 FNF:11 FNH:10 LF:25 @@ -1287,15 +1263,15 @@ end_of_record TN: SF:src/modules/fundingManager/token/ElasticReceiptTokenBase.sol FN:201,ElasticReceiptTokenBase.transfer -FNDA:493,ElasticReceiptTokenBase.transfer -DA:209,493 -DA:211,493 +FNDA:494,ElasticReceiptTokenBase.transfer +DA:209,494 +DA:211,494 DA:213,256 FN:217,ElasticReceiptTokenBase.transferFrom -FNDA:1262,ElasticReceiptTokenBase.transferFrom -DA:226,1262 -DA:228,1262 -DA:229,750 +FNDA:1260,ElasticReceiptTokenBase.transferFrom +DA:226,1260 +DA:228,1260 +DA:229,748 DA:231,512 FN:235,ElasticReceiptTokenBase.transferAll FNDA:256,ElasticReceiptTokenBase.transferAll @@ -1315,10 +1291,10 @@ DA:269,256 DA:272,512 DA:274,512 FN:278,ElasticReceiptTokenBase.approve -FNDA:2030,ElasticReceiptTokenBase.approve -DA:284,2030 -DA:286,2030 -DA:287,2030 +FNDA:2028,ElasticReceiptTokenBase.approve +DA:284,2028 +DA:286,2028 +DA:287,2028 FN:295,ElasticReceiptTokenBase.increaseAllowance FNDA:512,ElasticReceiptTokenBase.increaseAllowance DA:299,512 @@ -1354,8 +1330,8 @@ FN:398,ElasticReceiptTokenBase.totalSupply FNDA:779,ElasticReceiptTokenBase.totalSupply DA:399,779 FN:403,ElasticReceiptTokenBase.balanceOf -FNDA:53225,ElasticReceiptTokenBase.balanceOf -DA:404,53225 +FNDA:69650,ElasticReceiptTokenBase.balanceOf +DA:404,69650 FN:408,ElasticReceiptTokenBase.scaledTotalSupply FNDA:2,ElasticReceiptTokenBase.scaledTotalSupply DA:409,2 @@ -1369,67 +1345,67 @@ FN:426,ElasticReceiptTokenBase.DOMAIN_SEPARATOR FNDA:1,ElasticReceiptTokenBase.DOMAIN_SEPARATOR DA:427,2 FN:442,ElasticReceiptTokenBase._tokensToBits -FNDA:30582,ElasticReceiptTokenBase._tokensToBits -DA:443,30582 +FNDA:38769,ElasticReceiptTokenBase._tokensToBits +DA:443,38769 FN:449,ElasticReceiptTokenBase._bitsToTokens -FNDA:7723,ElasticReceiptTokenBase._bitsToTokens -DA:450,7723 +FNDA:10005,ElasticReceiptTokenBase._bitsToTokens +DA:450,10005 FN:459,ElasticReceiptTokenBase._mint -FNDA:22521,ElasticReceiptTokenBase._mint -DA:466,22487 -BRDA:466,4,0,362 -BRDA:466,4,1,22125 -DA:467,362 -DA:471,22125 -DA:472,22125 -DA:478,22125 -DA:479,22125 -BRDA:479,5,0,4222 -BRDA:479,5,1,22125 -DA:480,4222 -DA:484,22125 -DA:485,22125 -DA:488,22125 +FNDA:28435,ElasticReceiptTokenBase._mint +DA:466,28397 +BRDA:466,4,0,363 +BRDA:466,4,1,28034 +DA:467,363 +DA:471,28034 +DA:472,28034 +DA:478,28034 +DA:479,28034 +BRDA:479,5,0,4217 +BRDA:479,5,1,28034 +DA:480,4217 +DA:484,28034 +DA:485,28034 +DA:488,28034 FN:498,ElasticReceiptTokenBase._burn -FNDA:6699,ElasticReceiptTokenBase._burn -DA:506,6699 -DA:507,6699 -DA:510,6699 -DA:511,6699 -DA:516,6699 -DA:517,6699 -DA:520,6549 -DA:521,6549 -DA:524,6549 +FNDA:8981,ElasticReceiptTokenBase._burn +DA:506,8981 +DA:507,8981 +DA:510,8981 +DA:511,8981 +DA:516,8981 +DA:517,8981 +DA:520,8832 +DA:521,8832 +DA:524,8832 FN:533,ElasticReceiptTokenBase._rebase -FNDA:33272,ElasticReceiptTokenBase._rebase -DA:534,33272 -DA:538,33272 -BRDA:538,6,0,4586 -BRDA:538,6,1,28686 -DA:539,4586 -DA:543,28686 -DA:544,28686 -DA:547,28686 -DA:548,28686 +FNDA:41460,ElasticReceiptTokenBase._rebase +DA:534,41460 +DA:538,41460 +BRDA:538,6,0,4582 +BRDA:538,6,1,36878 +DA:539,4582 +DA:543,36878 +DA:544,36878 +DA:547,36878 +DA:548,36878 FN:553,ElasticReceiptTokenBase._activeBits -FNDA:57512,ElasticReceiptTokenBase._activeBits -DA:554,57512 +FNDA:73895,ElasticReceiptTokenBase._activeBits +DA:554,73895 FN:559,ElasticReceiptTokenBase._transfer -FNDA:30838,ElasticReceiptTokenBase._transfer -DA:562,30838 -DA:563,30360 -DA:565,30360 -BRDA:565,7,0,2664 -BRDA:565,7,1,30360 -DA:566,2664 -DA:569,30360 +FNDA:39025,ElasticReceiptTokenBase._transfer +DA:562,39025 +DA:563,38551 +DA:565,38551 +BRDA:565,7,0,2735 +BRDA:565,7,1,38551 +DA:566,2735 +DA:569,38551 FN:574,ElasticReceiptTokenBase._useAllowance -FNDA:2030,ElasticReceiptTokenBase._useAllowance -DA:578,2030 -BRDA:578,8,0,1774 -BRDA:578,8,1,1262 -DA:579,1774 +FNDA:2028,ElasticReceiptTokenBase._useAllowance +DA:578,2028 +BRDA:578,8,0,1772 +BRDA:578,8,1,1260 +DA:579,1772 FNF:24 FNH:24 LF:78 @@ -1485,144 +1461,143 @@ end_of_record TN: SF:src/modules/logicModule/BountyManager.sol FN:84,BountyManager.validContributorsForBounty -FNDA:138340,BountyManager.validContributorsForBounty -DA:89,138340 -DA:91,138340 -BRDA:91,0,0,10 -BRDA:91,0,1,138330 -DA:92,10 -DA:94,138330 -DA:95,138330 -DA:96,138330 -DA:97,138330 -DA:98,138330 -DA:99,596209 -DA:102,596209 -BRDA:102,1,0,107 -BRDA:102,1,1,596102 -DA:103,107 -DA:106,596102 -DA:108,596102 -DA:109,596086 +FNDA:138596,BountyManager.validContributorsForBounty +DA:89,138596 +DA:91,138596 +BRDA:91,0,0,3 +BRDA:91,0,1,138593 +DA:92,3 +DA:94,138593 +DA:95,138593 +DA:96,138593 +DA:97,138593 +DA:98,138593 +DA:99,575377 +DA:102,575377 +BRDA:102,1,0,103 +BRDA:102,1,1,575274 +DA:103,103 +DA:106,575274 +DA:108,575274 +DA:109,575258 BRDA:107,2,0,16 -BRDA:107,2,1,596086 +BRDA:107,2,1,575258 DA:111,16 -DA:114,596086 -DA:116,596086 -DA:121,138207 -DA:122,138164 -BRDA:120,3,0,67 -BRDA:120,3,1,138140 -DA:124,67 +DA:114,575258 +DA:116,575258 +DA:121,138474 +DA:122,138430 +BRDA:120,3,0,77 +BRDA:120,3,1,138397 +DA:124,77 FN:142,BountyManager.contributorsNotChanged -FNDA:958,BountyManager.contributorsNotChanged -DA:146,958 -DA:149,958 -DA:150,958 -DA:152,12855 -DA:153,12768 -BRDA:151,4,0,87 -BRDA:151,4,1,12768 -DA:154,87 -DA:156,12768 -FN:191,BountyManager.init +FNDA:956,BountyManager.contributorsNotChanged +DA:146,956 +DA:149,956 +DA:150,956 +DA:152,12555 +DA:153,12469 +BRDA:151,4,0,86 +BRDA:151,4,1,12469 +DA:154,86 +DA:156,12469 +FN:195,BountyManager.init FNDA:5,BountyManager.init -DA:196,4 -DA:198,4 -DA:199,4 -FN:202,BountyManager.init2 +DA:200,4 +DA:202,4 +DA:203,4 +FN:206,BountyManager.init2 FNDA:3,BountyManager.init2 -DA:209,3 -FN:216,BountyManager.getBountyInformation -FNDA:4108,BountyManager.getBountyInformation -DA:222,3877 -FN:226,BountyManager.listBountyIds +FN:219,BountyManager.getBountyInformation +FNDA:4483,BountyManager.getBountyInformation +DA:225,4256 +FN:229,BountyManager.listBountyIds FNDA:0,BountyManager.listBountyIds -DA:227,0 -FN:231,BountyManager.isExistingBountyId +DA:230,0 +FN:234,BountyManager.isExistingBountyId FNDA:2,BountyManager.isExistingBountyId -DA:232,142448 -FN:236,BountyManager.getClaimInformation -FNDA:7674,BountyManager.getClaimInformation -DA:242,7435 -FN:246,BountyManager.listClaimIds +DA:235,143082 +FN:239,BountyManager.getClaimInformation +FNDA:7041,BountyManager.getClaimInformation +DA:245,6803 +FN:249,BountyManager.listClaimIds FNDA:0,BountyManager.listClaimIds -DA:247,0 -FN:251,BountyManager.isExistingClaimId +DA:250,0 +FN:254,BountyManager.isExistingClaimId FNDA:0,BountyManager.isExistingClaimId -DA:252,9639 -FN:256,BountyManager.listClaimIdsForContributorAddress -FNDA:308601,BountyManager.listClaimIdsForContributorAddress -DA:261,308601 -FN:268,BountyManager.addBounty -FNDA:130324,BountyManager.addBounty -DA:279,130199 -DA:282,130199 -DA:284,130199 -DA:286,130199 -DA:287,130199 -DA:288,130199 -DA:290,130199 -DA:294,130199 -FN:298,BountyManager.updateBounty +DA:255,8995 +FN:259,BountyManager.listClaimIdsForContributorAddress +FNDA:286654,BountyManager.listClaimIdsForContributorAddress +DA:264,286654 +FN:271,BountyManager.addBounty +FNDA:136339,BountyManager.addBounty +DA:282,136195 +DA:285,136195 +DA:287,136195 +DA:289,136195 +DA:290,136195 +DA:291,136195 +DA:293,136195 +DA:297,136195 +FN:301,BountyManager.updateBounty FNDA:259,BountyManager.updateBounty -DA:304,256 -DA:306,256 -FN:310,BountyManager.lockBounty -FNDA:82,BountyManager.lockBounty -DA:316,79 -DA:318,79 -FN:322,BountyManager.addClaim -FNDA:138000,BountyManager.addClaim -DA:333,137997 -DA:335,137798 -DA:338,137798 -DA:340,137798 -DA:343,137798 -DA:345,137798 -DA:346,137798 -DA:347,582015 -DA:349,582015 -DA:351,582015 -DA:355,137798 -DA:357,137798 -DA:359,137798 -FN:363,BountyManager.updateClaimContributors -FNDA:347,BountyManager.updateClaimContributors -DA:373,343 +DA:307,256 +DA:309,256 +FN:313,BountyManager.lockBounty +FNDA:84,BountyManager.lockBounty +DA:319,81 +DA:321,81 +FN:325,BountyManager.addClaim +FNDA:138257,BountyManager.addClaim +DA:336,138254 +DA:338,138056 +DA:341,138056 +DA:343,138056 +DA:346,138056 +DA:348,138056 +DA:349,138056 +DA:350,560997 +DA:352,560997 +DA:354,560997 +DA:358,138056 +DA:360,138056 +DA:362,138056 +FN:366,BountyManager.updateClaimContributors +FNDA:346,BountyManager.updateClaimContributors DA:376,342 -DA:378,342 -DA:379,342 -DA:381,684 -DA:383,684 -DA:387,342 -DA:389,342 -DA:391,342 -DA:392,11687 -DA:394,11687 -DA:396,11687 -DA:400,342 -FN:404,BountyManager.updateClaimDetails +DA:379,341 +DA:381,341 +DA:382,341 +DA:384,682 +DA:386,682 +DA:390,341 +DA:392,341 +DA:394,341 +DA:395,11485 +DA:397,11485 +DA:399,11485 +DA:403,341 +FN:407,BountyManager.updateClaimDetails FNDA:516,BountyManager.updateClaimDetails -DA:411,256 -DA:413,256 -FN:417,BountyManager.verifyClaim -FNDA:1103,BountyManager.verifyClaim -DA:424,958 -DA:426,871 -DA:428,871 -DA:431,871 -DA:434,871 -DA:435,12768 -DA:437,12768 -DA:446,12768 -DA:451,871 -DA:456,871 -DA:458,871 +DA:414,258 +DA:416,258 +FN:420,BountyManager.verifyClaim +FNDA:1093,BountyManager.verifyClaim +DA:427,956 +DA:429,870 +DA:431,870 +DA:434,870 +DA:437,870 +DA:438,12469 +DA:440,12469 +DA:449,12469 +DA:454,870 +DA:459,870 +DA:461,870 FNF:18 FNH:15 -LF:89 -LH:87 +LF:88 +LH:86 BRF:10 BRH:10 end_of_record @@ -1638,75 +1613,75 @@ BRDA:90,0,0,2 BRDA:90,0,1,2310 DA:91,2 FN:99,RecurringPaymentManager.getEpochLength -FNDA:38243,RecurringPaymentManager.getEpochLength -DA:100,38243 +FNDA:37793,RecurringPaymentManager.getEpochLength +DA:100,37793 FN:104,RecurringPaymentManager.getRecurringPaymentInformation -FNDA:320071,RecurringPaymentManager.getRecurringPaymentInformation -DA:110,319839 +FNDA:317237,RecurringPaymentManager.getRecurringPaymentInformation +DA:110,317014 FN:114,RecurringPaymentManager.listRecurringPaymentIds -FNDA:13634,RecurringPaymentManager.listRecurringPaymentIds -DA:115,13634 +FNDA:13998,RecurringPaymentManager.listRecurringPaymentIds +DA:115,13998 FN:119,RecurringPaymentManager.getPreviousPaymentId FNDA:0,RecurringPaymentManager.getPreviousPaymentId DA:120,0 FN:124,RecurringPaymentManager.isExistingRecurringPaymentId FNDA:0,RecurringPaymentManager.isExistingRecurringPaymentId -DA:125,321863 +DA:125,319029 FN:132,RecurringPaymentManager.getEpochFromTimestamp FNDA:0,RecurringPaymentManager.getEpochFromTimestamp DA:137,0 FN:141,RecurringPaymentManager.getCurrentEpoch -FNDA:136822,RecurringPaymentManager.getCurrentEpoch -DA:142,319663 +FNDA:141746,RecurringPaymentManager.getCurrentEpoch +DA:142,330559 FN:146,RecurringPaymentManager.getFutureEpoch FNDA:768,RecurringPaymentManager.getFutureEpoch DA:151,768 FN:158,RecurringPaymentManager.addRecurringPayment -FNDA:171232,RecurringPaymentManager.addRecurringPayment -DA:171,171180 -DA:174,171180 -DA:177,171180 -DA:178,171180 -DA:179,171180 -DA:180,171180 -DA:182,171180 -DA:190,171180 +FNDA:176829,RecurringPaymentManager.addRecurringPayment +DA:171,176780 +DA:174,176780 +DA:177,176780 +DA:178,176780 +DA:179,176780 +DA:180,176780 +DA:182,176780 +DA:190,176780 FN:194,RecurringPaymentManager.removeRecurringPayment -FNDA:7537,RecurringPaymentManager.removeRecurringPayment -DA:199,7536 -DA:202,7536 -DA:205,7536 -DA:207,7536 +FNDA:7923,RecurringPaymentManager.removeRecurringPayment +DA:199,7922 +DA:202,7922 +DA:205,7922 +DA:207,7922 FN:214,RecurringPaymentManager.trigger -FNDA:3051,RecurringPaymentManager.trigger -DA:215,3051 +FNDA:3040,RecurringPaymentManager.trigger +DA:215,3040 FN:219,RecurringPaymentManager.triggerFor FNDA:1024,RecurringPaymentManager.triggerFor DA:226,256 FN:229,RecurringPaymentManager._triggerFor -FNDA:10843,RecurringPaymentManager._triggerFor -DA:231,10843 -DA:233,10843 -DA:235,10843 -DA:237,10843 -DA:240,167175 -DA:241,156332 -DA:244,156332 -BRDA:244,1,0,15976 -BRDA:244,1,1,25759 -DA:245,25759 -DA:248,25759 -BRDA:248,2,0,15976 -BRDA:248,2,1,25759 -DA:250,25759 -DA:261,25759 -BRDA:261,3,0,15976 -BRDA:261,3,1,25759 -DA:262,15976 -DA:275,25759 -DA:280,156332 -DA:284,10843 -DA:286,10843 +FNDA:11218,RecurringPaymentManager._triggerFor +DA:231,11218 +DA:233,11218 +DA:235,11218 +DA:237,11218 +DA:240,166009 +DA:241,154791 +DA:244,154791 +BRDA:244,1,0,15732 +BRDA:244,1,1,25961 +DA:245,25961 +DA:248,25961 +BRDA:248,2,0,15732 +BRDA:248,2,1,25961 +DA:250,25961 +DA:261,25961 +BRDA:261,3,0,15732 +BRDA:261,3,1,25961 +DA:262,15732 +DA:275,25961 +DA:280,154791 +DA:284,11218 +DA:286,11218 FNF:14 FNH:11 LF:43 @@ -1717,10 +1692,10 @@ end_of_record TN: SF:src/modules/logicModule/paymentClient/ERC20PaymentClient.sol FN:62,ERC20PaymentClient._addPaymentOrder -FNDA:145935,ERC20PaymentClient._addPaymentOrder -DA:68,145932 -DA:71,145932 -DA:73,145932 +FNDA:145448,ERC20PaymentClient._addPaymentOrder +DA:68,145445 +DA:71,145445 +DA:73,145445 FN:79,ERC20PaymentClient._addPaymentOrders FNDA:1,ERC20PaymentClient._addPaymentOrders DA:80,1 @@ -1734,67 +1709,67 @@ DA:93,3 DA:95,3 DA:99,1 FN:106,ERC20PaymentClient.collectPaymentOrders -FNDA:7154,ERC20PaymentClient.collectPaymentOrders -DA:112,7154 +FNDA:7143,ERC20PaymentClient.collectPaymentOrders +DA:112,7143 BRDA:112,0,0,1 -BRDA:112,0,1,7153 +BRDA:112,0,1,7142 DA:113,1 -DA:118,7153 -DA:123,7153 -DA:124,7153 -DA:125,7153 -DA:126,129143 -DA:130,7153 -DA:133,7153 -DA:136,7153 -DA:140,7153 -DA:144,7153 +DA:118,7142 +DA:123,7142 +DA:124,7142 +DA:125,7142 +DA:126,128726 +DA:130,7142 +DA:133,7142 +DA:136,7142 +DA:140,7142 +DA:144,7142 FN:148,ERC20PaymentClient.paymentOrders -FNDA:8432,ERC20PaymentClient.paymentOrders -DA:154,8432 +FNDA:8421,ERC20PaymentClient.paymentOrders +DA:154,8421 FN:158,ERC20PaymentClient.outstandingTokenAmount FNDA:513,ERC20PaymentClient.outstandingTokenAmount DA:159,513 FN:165,ERC20PaymentClient._ensureValidRecipient -FNDA:171181,ERC20PaymentClient._ensureValidRecipient -DA:166,171181 +FNDA:176781,ERC20PaymentClient._ensureValidRecipient +DA:166,176781 BRDA:166,1,0,1 -BRDA:166,1,1,171180 +BRDA:166,1,1,176780 DA:167,1 FN:171,ERC20PaymentClient._ensureValidAmount -FNDA:171231,ERC20PaymentClient._ensureValidAmount -DA:172,171231 +FNDA:176828,ERC20PaymentClient._ensureValidAmount +DA:172,176828 BRDA:172,2,0,1 -BRDA:172,2,1,171230 +BRDA:172,2,1,176827 FN:175,ERC20PaymentClient._ensureValidPaymentOrder -FNDA:145938,ERC20PaymentClient._ensureValidPaymentOrder -DA:176,145938 +FNDA:145451,ERC20PaymentClient._ensureValidPaymentOrder +DA:176,145451 BRDA:176,3,0,1 -BRDA:176,3,1,145937 +BRDA:176,3,1,145450 DA:177,1 -DA:179,145937 +DA:179,145450 BRDA:179,4,0,2 -BRDA:179,4,1,145935 +BRDA:179,4,1,145448 DA:180,2 FN:188,ERC20PaymentClient._ensureTokenBalance -FNDA:3821,ERC20PaymentClient._ensureTokenBalance -DA:191,3821 -DA:192,3821 -DA:200,3821 +FNDA:3810,ERC20PaymentClient._ensureTokenBalance +DA:191,3810 +DA:192,3810 +DA:200,3810 BRDA:200,5,0,256 -BRDA:200,5,1,3565 +BRDA:200,5,1,3554 DA:201,256 FN:206,ERC20PaymentClient._ensureTokenAllowance -FNDA:3565,ERC20PaymentClient._ensureTokenAllowance -DA:210,3565 -DA:211,3565 -DA:213,3565 -BRDA:213,6,0,2464 -BRDA:213,6,1,3565 -DA:214,2464 +FNDA:3554,ERC20PaymentClient._ensureTokenAllowance +DA:210,3554 +DA:211,3554 +DA:213,3554 +BRDA:213,6,0,2459 +BRDA:213,6,1,3554 +DA:214,2459 FN:219,ERC20PaymentClient._isAuthorizedPaymentProcessor -FNDA:3565,ERC20PaymentClient._isAuthorizedPaymentProcessor -DA:225,3565 +FNDA:3554,ERC20PaymentClient._isAuthorizedPaymentProcessor +DA:225,3554 FNF:11 FNH:11 LF:43 @@ -1841,12 +1816,12 @@ FN:85,StreamingPaymentProcessor.init FNDA:259,StreamingPaymentProcessor.init DA:90,258 FN:94,StreamingPaymentProcessor.claimAll -FNDA:55105,StreamingPaymentProcessor.claimAll -DA:96,55105 -BRDA:95,0,0,9563 -BRDA:95,0,1,45542 -DA:101,9563 -DA:106,45542 +FNDA:54642,StreamingPaymentProcessor.claimAll +DA:96,54642 +BRDA:95,0,0,10270 +BRDA:95,0,1,44372 +DA:101,10270 +DA:106,44372 FN:110,StreamingPaymentProcessor.claimForSpecificWalletId FNDA:513,StreamingPaymentProcessor.claimForSpecificWalletId DA:116,513 @@ -1863,7 +1838,7 @@ FN:139,StreamingPaymentProcessor.processPayments FNDA:4358,StreamingPaymentProcessor.processPayments DA:145,3846 BRDA:145,3,0,- -BRDA:145,3,1,92723 +BRDA:145,3,1,92577 DA:147,3590 DA:148,3590 DA:149,3590 @@ -1878,14 +1853,14 @@ DA:160,3590 DA:161,3590 DA:163,3590 DA:165,3590 -DA:166,92723 -DA:167,92723 -DA:168,92723 -DA:169,92723 -DA:170,92723 -DA:172,92723 -DA:181,92723 -DA:191,92723 +DA:166,92577 +DA:167,92577 +DA:168,92577 +DA:169,92577 +DA:170,92577 +DA:172,92577 +DA:181,92577 +DA:191,92577 FN:198,StreamingPaymentProcessor.cancelRunningPayments FNDA:1025,StreamingPaymentProcessor.cancelRunningPayments DA:203,513 @@ -1905,30 +1880,30 @@ BRDA:236,6,0,513 BRDA:236,6,1,513 DA:240,513 FN:248,StreamingPaymentProcessor.isActivePaymentReceiver -FNDA:20802,StreamingPaymentProcessor.isActivePaymentReceiver -DA:253,20802 +FNDA:20598,StreamingPaymentProcessor.isActivePaymentReceiver +DA:253,20598 FN:257,StreamingPaymentProcessor.startForSpecificWalletId -FNDA:13420,StreamingPaymentProcessor.startForSpecificWalletId -DA:262,992325 +FNDA:12368,StreamingPaymentProcessor.startForSpecificWalletId +DA:262,1008404 FN:266,StreamingPaymentProcessor.dueToForSpecificWalletId -FNDA:13420,StreamingPaymentProcessor.dueToForSpecificWalletId -DA:271,1086408 +FNDA:12368,StreamingPaymentProcessor.dueToForSpecificWalletId +DA:271,1100627 FN:275,StreamingPaymentProcessor.releasedForSpecificWalletId -FNDA:13421,StreamingPaymentProcessor.releasedForSpecificWalletId -DA:280,968389 +FNDA:12369,StreamingPaymentProcessor.releasedForSpecificWalletId +DA:280,985464 FN:284,StreamingPaymentProcessor.vestedAmountForSpecificWalletId -FNDA:23937,StreamingPaymentProcessor.vestedAmountForSpecificWalletId -DA:290,978905 +FNDA:22941,StreamingPaymentProcessor.vestedAmountForSpecificWalletId +DA:290,996036 FN:296,StreamingPaymentProcessor.releasableForSpecificWalletId -FNDA:884385,StreamingPaymentProcessor.releasableForSpecificWalletId -DA:301,954968 -DA:303,954968 +FNDA:904027,StreamingPaymentProcessor.releasableForSpecificWalletId +DA:301,973095 +DA:303,973095 FN:307,StreamingPaymentProcessor.unclaimable FNDA:261,StreamingPaymentProcessor.unclaimable -DA:312,55368 +DA:312,54905 FN:316,StreamingPaymentProcessor.token FNDA:1,StreamingPaymentProcessor.token -DA:317,74174 +DA:317,72659 FN:321,StreamingPaymentProcessor.viewAllPaymentOrders FNDA:2563,StreamingPaymentProcessor.viewAllPaymentOrders DA:327,2563 @@ -1941,35 +1916,35 @@ DA:336,5384 DA:340,5384 DA:344,2563 FN:354,StreamingPaymentProcessor._afterClaimCleanup -FNDA:70319,StreamingPaymentProcessor._afterClaimCleanup -DA:360,70319 -DA:363,70319 -DA:369,70319 -BRDA:369,7,0,68522 -BRDA:369,7,1,70319 -DA:370,68522 -DA:377,70319 +FNDA:68804,StreamingPaymentProcessor._afterClaimCleanup +DA:360,68804 +DA:363,68804 +DA:369,68804 +BRDA:369,7,0,67007 +BRDA:369,7,1,68804 +DA:370,67007 +DA:377,68804 FN:386,StreamingPaymentProcessor._findAddressInActiveVestings -FNDA:161241,StreamingPaymentProcessor._findAddressInActiveVestings -DA:390,161241 -DA:392,161241 -DA:393,161241 -DA:394,4506693 -BRDA:394,8,0,71088 -BRDA:394,8,1,4435605 -DA:395,71088 -DA:398,4435605 -DA:401,90153 +FNDA:159580,StreamingPaymentProcessor._findAddressInActiveVestings +DA:390,159580 +DA:392,159580 +DA:393,159580 +DA:394,4359294 +BRDA:394,8,0,69573 +BRDA:394,8,1,4289721 +DA:395,69573 +DA:398,4289721 +DA:401,90007 FN:411,StreamingPaymentProcessor._findActiveWalletId -FNDA:70832,StreamingPaymentProcessor._findActiveWalletId -DA:416,70832 -DA:418,70832 -DA:420,70832 -DA:421,71857 -DA:422,71857 -BRDA:422,9,0,70832 +FNDA:69317,StreamingPaymentProcessor._findActiveWalletId +DA:416,69317 +DA:418,69317 +DA:420,69317 +DA:421,70342 +DA:422,70342 +BRDA:422,9,0,69317 BRDA:422,9,1,1025 -DA:423,70832 +DA:423,69317 DA:426,1025 DA:430,0 FN:437,StreamingPaymentProcessor._cancelRunningOrders @@ -1977,120 +1952,120 @@ FNDA:513,StreamingPaymentProcessor._cancelRunningOrders DA:438,513 DA:439,513 DA:441,513 -DA:442,23497 -DA:443,22984 -DA:446,22984 +DA:442,23152 +DA:443,22639 +DA:446,22639 FN:457,StreamingPaymentProcessor._removePayment -FNDA:22985,StreamingPaymentProcessor._removePayment -DA:458,22985 -DA:460,22985 -DA:462,22985 -DA:463,22985 -DA:464,45972 -DA:465,22987 -DA:466,22987 -DA:471,22987 -DA:472,22987 -BRDA:470,10,0,17219 -BRDA:470,10,1,22987 -DA:474,17219 -DA:478,22987 +FNDA:22640,StreamingPaymentProcessor._removePayment +DA:458,22640 +DA:460,22640 +DA:462,22640 +DA:463,22640 +DA:464,45282 +DA:465,22642 +DA:466,22642 +DA:471,22642 +DA:472,22642 +BRDA:470,10,0,16600 +BRDA:470,10,1,22642 +DA:474,16600 +DA:478,22642 FN:489,StreamingPaymentProcessor._removePaymentForSpecificWalletId -FNDA:70319,StreamingPaymentProcessor._removePaymentForSpecificWalletId -DA:494,70319 -DA:495,70319 -DA:497,70319 +FNDA:68804,StreamingPaymentProcessor._removePaymentForSpecificWalletId +DA:494,68804 +DA:495,68804 +DA:497,68804 BRDA:497,11,0,- -BRDA:497,11,1,70319 +BRDA:497,11,1,68804 DA:498,0 -DA:506,70319 -DA:510,70319 +DA:506,68804 +DA:510,68804 FN:519,StreamingPaymentProcessor._removeVestingInformationForSpecificWalletId -FNDA:70319,StreamingPaymentProcessor._removeVestingInformationForSpecificWalletId -DA:524,70319 +FNDA:68804,StreamingPaymentProcessor._removeVestingInformationForSpecificWalletId +DA:524,68804 FN:532,StreamingPaymentProcessor._removePaymentReceiverFromActiveVestings -FNDA:68522,StreamingPaymentProcessor._removePaymentReceiverFromActiveVestings -DA:537,68522 -DA:538,68522 -DA:540,68522 +FNDA:67007,StreamingPaymentProcessor._removePaymentReceiverFromActiveVestings +DA:537,67007 +DA:538,67007 +DA:540,67007 BRDA:540,12,0,- -BRDA:540,12,1,68522 +BRDA:540,12,1,67007 DA:541,0 -DA:547,68522 -DA:548,68522 -DA:552,68522 +DA:547,67007 +DA:548,67007 +DA:552,67007 FN:564,StreamingPaymentProcessor._addPayment -FNDA:92723,StreamingPaymentProcessor._addPayment -DA:573,92723 -DA:574,92718 +FNDA:92577,StreamingPaymentProcessor._addPayment +DA:573,92577 +DA:574,92572 BRDA:572,13,0,5 -BRDA:572,13,1,92718 +BRDA:572,13,1,92572 DA:576,5 -DA:580,92718 -DA:582,92718 -DA:588,92718 -BRDA:587,14,0,90153 -BRDA:587,14,1,92718 -DA:591,90153 -DA:594,92718 -DA:596,92718 +DA:580,92572 +DA:582,92572 +DA:588,92572 +BRDA:587,14,0,90007 +BRDA:587,14,1,92572 +DA:591,90007 +DA:594,92572 +DA:596,92572 FN:609,StreamingPaymentProcessor._claimAll -FNDA:45542,StreamingPaymentProcessor._claimAll -DA:610,45542 -DA:612,45542 -DA:614,45542 -DA:615,92112 -DA:616,46570 -DA:621,46570 +FNDA:44372,StreamingPaymentProcessor._claimAll +DA:610,44372 +DA:612,44372 +DA:614,44372 +DA:615,89772 +DA:616,45400 +DA:621,45400 FN:634,StreamingPaymentProcessor._claimForSpecificWalletId -FNDA:70583,StreamingPaymentProcessor._claimForSpecificWalletId -DA:640,70583 -DA:641,70583 -DA:642,70583 -DA:645,70583 -DA:646,69557 +FNDA:69068,StreamingPaymentProcessor._claimForSpecificWalletId +DA:640,69068 +DA:641,69068 +DA:642,69068 +DA:645,69068 +DA:646,68042 BRDA:644,15,0,2 -BRDA:644,15,1,70583 +BRDA:644,15,1,69068 DA:648,2 DA:649,2 -DA:652,70583 -DA:654,70583 -DA:663,70583 -BRDA:663,16,0,70581 +DA:652,69068 +DA:654,69068 +DA:663,69068 +BRDA:663,16,0,69066 BRDA:663,16,1,2 -DA:664,70581 +DA:664,69066 DA:666,2 -DA:669,70583 -DA:670,70583 -DA:673,70583 -BRDA:673,17,0,52587 -BRDA:673,17,1,70583 -DA:674,52587 +DA:669,69068 +DA:670,69068 +DA:673,69068 +BRDA:673,17,0,51691 +BRDA:673,17,1,69068 +DA:674,51691 FN:684,StreamingPaymentProcessor._vestingAmountForSpecificWalletId -FNDA:978905,StreamingPaymentProcessor._vestingAmountForSpecificWalletId -DA:690,978905 -DA:692,978905 -DA:693,978905 -DA:694,978905 -DA:695,978905 -DA:697,978905 +FNDA:996036,StreamingPaymentProcessor._vestingAmountForSpecificWalletId +DA:690,996036 +DA:692,996036 +DA:693,996036 +DA:694,996036 +DA:695,996036 +DA:697,996036 BRDA:697,18,0,- -BRDA:697,18,1,978905 +BRDA:697,18,1,996036 DA:698,0 -DA:699,978905 -BRDA:699,19,0,129513 -BRDA:699,19,1,849392 -DA:700,129513 -DA:702,849392 +DA:699,996036 +BRDA:699,19,0,126635 +BRDA:699,19,1,869401 +DA:700,126635 +DA:702,869401 FN:710,StreamingPaymentProcessor.validAddress -FNDA:92723,StreamingPaymentProcessor.validAddress -DA:711,92723 +FNDA:92577,StreamingPaymentProcessor.validAddress +DA:711,92577 FN:720,StreamingPaymentProcessor.validSalary -FNDA:92719,StreamingPaymentProcessor.validSalary -DA:721,92719 +FNDA:92573,StreamingPaymentProcessor.validSalary +DA:721,92573 FN:727,StreamingPaymentProcessor.validStart -FNDA:92718,StreamingPaymentProcessor.validStart -DA:728,92718 +FNDA:92572,StreamingPaymentProcessor.validStart +DA:728,92572 FNF:31 FNH:31 LF:152 @@ -2173,29 +2148,29 @@ BRDA:106,2,1,516 DA:110,0 DA:114,516 DA:115,516 -DA:116,7158 -DA:119,7158 -DA:120,7156 +DA:116,7327 +DA:119,7327 +DA:120,7325 BRDA:118,3,0,3 -BRDA:118,3,1,7155 +BRDA:118,3,1,7324 DA:122,3 -DA:125,7155 +DA:125,7324 BRDA:125,4,0,256 -BRDA:125,4,1,6899 +BRDA:125,4,1,7068 DA:126,256 -DA:129,6899 -DA:130,6899 +DA:129,7068 +DA:130,7068 DA:134,257 DA:137,257 DA:138,257 DA:141,257 DA:142,257 FN:148,SingleVoteGovernor.getReceipt -FNDA:44837,SingleVoteGovernor.getReceipt -DA:153,44837 -DA:155,44837 +FNDA:43820,SingleVoteGovernor.getReceipt +DA:153,43820 +DA:155,43820 FN:161,SingleVoteGovernor.setThreshold -FNDA:4928,SingleVoteGovernor.setThreshold +FNDA:4954,SingleVoteGovernor.setThreshold DA:163,259 BRDA:163,5,0,256 BRDA:163,5,1,3 @@ -2203,7 +2178,7 @@ DA:164,256 DA:170,3 DA:171,3 FN:174,SingleVoteGovernor.setVotingDuration -FNDA:4733,SingleVoteGovernor.setVotingDuration +FNDA:4750,SingleVoteGovernor.setVotingDuration DA:177,6 DA:178,5 BRDA:176,6,0,2 @@ -2212,99 +2187,99 @@ DA:180,2 DA:183,4 DA:184,4 FN:190,SingleVoteGovernor.addVoter -FNDA:63818,SingleVoteGovernor.addVoter -DA:191,58954 -BRDA:191,7,0,53609 -BRDA:191,7,1,58954 -DA:192,53609 -DA:194,53609 -DA:196,53609 +FNDA:62057,SingleVoteGovernor.addVoter +DA:191,57311 +BRDA:191,7,0,52466 +BRDA:191,7,1,57311 +DA:192,52466 +DA:194,52466 +DA:196,52466 FN:200,SingleVoteGovernor.removeVoter -FNDA:14156,SingleVoteGovernor.removeVoter -DA:202,9207 +FNDA:13655,SingleVoteGovernor.removeVoter +DA:202,8961 BRDA:202,8,0,1 -BRDA:202,8,1,9206 +BRDA:202,8,1,8960 DA:203,1 -DA:207,9206 +DA:207,8960 BRDA:207,9,0,1 -BRDA:207,9,1,9205 +BRDA:207,9,1,8959 DA:208,1 -DA:211,9205 -BRDA:211,10,0,4604 -BRDA:211,10,1,9205 -DA:212,4604 -DA:214,4604 -DA:216,4604 +DA:211,8959 +BRDA:211,10,0,4481 +BRDA:211,10,1,8959 +DA:212,4481 +DA:214,4481 +DA:216,4481 FN:223,SingleVoteGovernor.createMotion -FNDA:60628,SingleVoteGovernor.createMotion -DA:229,55465 -DA:233,55465 -DA:236,55465 -DA:237,55465 -DA:239,55465 -DA:240,55465 -DA:241,55465 -DA:243,55465 -DA:247,55465 -DA:250,55465 +FNDA:60323,SingleVoteGovernor.createMotion +DA:229,55248 +DA:233,55248 +DA:236,55248 +DA:237,55248 +DA:239,55248 +DA:240,55248 +DA:241,55248 +DA:243,55248 +DA:247,55248 +DA:250,55248 FN:253,SingleVoteGovernor.castVote -FNDA:366292,SingleVoteGovernor.castVote -DA:258,351245 +FNDA:373083,SingleVoteGovernor.castVote +DA:258,357727 BRDA:258,11,0,256 -BRDA:258,11,1,350989 +BRDA:258,11,1,357471 DA:259,256 -DA:263,350989 -BRDA:263,12,0,63843 -BRDA:263,12,1,287146 -DA:264,63843 -DA:268,287146 -DA:271,287146 -BRDA:271,13,0,102291 -BRDA:271,13,1,184855 -DA:272,102291 -DA:276,184855 -BRDA:276,14,0,14055 -BRDA:276,14,1,170800 -DA:277,14055 -DA:280,170800 -BRDA:280,15,0,155098 -BRDA:280,15,1,15702 -DA:282,155098 -DA:284,15702 -BRDA:284,16,0,10389 -BRDA:284,16,1,5313 -DA:286,10389 -DA:288,5313 -BRDA:288,17,0,5313 -BRDA:288,17,1,5313 -DA:290,5313 -DA:294,170800 +DA:263,357471 +BRDA:263,12,0,70476 +BRDA:263,12,1,286995 +DA:264,70476 +DA:268,286995 +DA:271,286995 +BRDA:271,13,0,103935 +BRDA:271,13,1,183060 +DA:272,103935 +DA:276,183060 +BRDA:276,14,0,14379 +BRDA:276,14,1,168681 +DA:277,14379 +DA:280,168681 +BRDA:280,15,0,153102 +BRDA:280,15,1,15579 +DA:282,153102 +DA:284,15579 +BRDA:284,16,0,10261 +BRDA:284,16,1,5318 +DA:286,10261 +DA:288,5318 +BRDA:288,17,0,5318 +BRDA:288,17,1,5318 +DA:290,5318 +DA:294,168681 FN:297,SingleVoteGovernor.executeMotion -FNDA:48529,SingleVoteGovernor.executeMotion -DA:299,48529 -DA:302,48529 +FNDA:47886,SingleVoteGovernor.executeMotion +DA:299,47886 +DA:302,47886 BRDA:302,18,0,256 -BRDA:302,18,1,48273 +BRDA:302,18,1,47630 DA:303,256 -DA:307,48273 +DA:307,47630 BRDA:307,19,0,2 -BRDA:307,19,1,48271 +BRDA:307,19,1,47628 DA:308,2 -DA:312,48271 +DA:312,47628 BRDA:312,20,0,1 -BRDA:312,20,1,48270 +BRDA:312,20,1,47627 DA:313,1 -DA:317,48270 +DA:317,47627 BRDA:317,21,0,1 -BRDA:317,21,1,48269 +BRDA:317,21,1,47626 DA:318,1 -DA:322,48269 -DA:325,48269 -DA:326,48269 -DA:327,48269 -DA:330,48269 -DA:331,48269 -DA:333,48269 +DA:322,47626 +DA:325,47626 +DA:326,47626 +DA:327,47626 +DA:330,47626 +DA:331,47626 +DA:333,47626 FNF:9 FNH:9 LF:93 @@ -2314,45 +2289,45 @@ BRH:42 end_of_record TN: SF:src/orchestrator/Orchestrator.sol -FN:94,Orchestrator.init -FNDA:16110,Orchestrator.init -DA:103,15854 -DA:106,15854 -DA:108,15854 -DA:110,15854 -DA:111,15854 -DA:112,15854 -DA:117,15854 -DA:118,15854 -DA:119,15854 -FN:130,Orchestrator._isModuleUsedInOrchestrator +FN:98,Orchestrator.init +FNDA:15244,Orchestrator.init +DA:107,14988 +DA:110,14988 +DA:112,14988 +DA:114,14988 +DA:115,14988 +DA:116,14988 +DA:121,14988 +DA:122,14988 +DA:123,14988 +FN:134,Orchestrator._isModuleUsedInOrchestrator FNDA:4,Orchestrator._isModuleUsedInOrchestrator -DA:135,4 -DA:136,4 -DA:137,4 -DA:138,4 -DA:140,10 -DA:141,10 -DA:143,10 -BRDA:143,0,0,- -BRDA:143,0,1,4 -DA:145,4 -DA:146,4 -BRDA:144,1,0,- -BRDA:144,1,1,4 -DA:148,4 -DA:153,6 -DA:157,0 -FN:161,Orchestrator.findModuleAddressInOrchestrator +DA:139,4 +DA:140,4 +DA:141,4 +DA:142,4 +DA:144,10 +DA:145,10 +DA:147,10 +BRDA:147,0,0,- +BRDA:147,0,1,4 +DA:149,4 +DA:150,4 +BRDA:148,1,0,- +BRDA:148,1,1,4 +DA:152,4 +DA:157,6 +DA:161,0 +FN:165,Orchestrator.findModuleAddressInOrchestrator FNDA:4,Orchestrator.findModuleAddressInOrchestrator -DA:166,4 -DA:167,4 -DA:168,4 -BRDA:168,2,0,- -BRDA:168,2,1,4 -DA:169,0 +DA:170,4 +DA:171,4 DA:172,4 -FN:182,Orchestrator.verifyAddressIsAuthorizerModule +BRDA:172,2,0,- +BRDA:172,2,1,4 +DA:173,0 +DA:176,4 +FN:186,Orchestrator.verifyAddressIsAuthorizerModule FNDA:0,Orchestrator.verifyAddressIsAuthorizerModule DA:191,0 DA:193,0 @@ -2396,14 +2371,16 @@ FN:297,Orchestrator.executeTx FNDA:1024,Orchestrator.executeTx DA:302,512 DA:303,512 -BRDA:303,3,0,256 -BRDA:303,3,1,256 -DA:304,256 -DA:306,256 -FN:314,Orchestrator.token -FNDA:149672,Orchestrator.token -DA:315,149672 -FN:319,Orchestrator.version +DA:304,512 +DA:306,512 +BRDA:306,3,0,256 +BRDA:306,3,1,256 +DA:307,256 +DA:309,256 +FN:317,Orchestrator.token +FNDA:170454,Orchestrator.token +DA:318,170454 +FN:322,Orchestrator.version FNDA:1,Orchestrator.version DA:323,1 FNF:14 @@ -2416,72 +2393,72 @@ end_of_record TN: SF:src/orchestrator/base/ModuleManager.sol FN:101,ModuleManager.__ModuleManager_init -FNDA:16371,ModuleManager.__ModuleManager_init -DA:105,16370 -DA:107,16370 -DA:108,16370 -DA:112,16370 -BRDA:112,0,0,260 -BRDA:112,0,1,16110 -DA:113,260 -DA:116,16110 -DA:117,170584 -DA:119,170584 +FNDA:15505,ModuleManager.__ModuleManager_init +DA:105,15504 +DA:107,15504 +DA:108,15504 +DA:112,15504 +BRDA:112,0,0,262 +BRDA:112,0,1,15242 +DA:113,262 +DA:116,15242 +DA:117,169342 +DA:119,169342 FN:123,ModuleManager.__ModuleManager_addModule -FNDA:218146,ModuleManager.__ModuleManager_addModule -DA:128,218142 +FNDA:214306,ModuleManager.__ModuleManager_addModule +DA:128,214302 FN:147,ModuleManager.isModule -FNDA:99765,ModuleManager.isModule -DA:153,430824 +FNDA:101584,ModuleManager.isModule +DA:153,430147 FN:157,ModuleManager.listModules -FNDA:1278,ModuleManager.listModules -DA:158,1282 +FNDA:1276,ModuleManager.listModules +DA:158,1280 FN:162,ModuleManager.modulesSize FNDA:0,ModuleManager.modulesSize DA:163,0 FN:170,ModuleManager.addModule -FNDA:78308,ModuleManager.addModule -DA:177,78308 +FNDA:79307,ModuleManager.addModule +DA:177,79307 FN:181,ModuleManager.removeModule -FNDA:30519,ModuleManager.removeModule -DA:186,30778 +FNDA:30875,ModuleManager.removeModule +DA:186,31134 FN:193,ModuleManager.executeTxFromModule -FNDA:3312,ModuleManager.executeTxFromModule -DA:199,3311 -DA:200,3311 -DA:202,3311 -DA:204,3311 +FNDA:3301,ModuleManager.executeTxFromModule +DA:199,3300 +DA:200,3300 +DA:202,3300 +DA:204,3300 FN:212,ModuleManager._commitAddModule -FNDA:296450,ModuleManager._commitAddModule -DA:214,296450 -DA:215,296450 -DA:216,296450 +FNDA:293609,ModuleManager._commitAddModule +DA:214,293609 +DA:215,293609 +DA:216,293609 FN:221,ModuleManager._commitRemoveModule -FNDA:30778,ModuleManager._commitRemoveModule -DA:228,30778 -DA:230,30778 -DA:232,30778 -DA:233,30778 -DA:234,962344 -BRDA:234,1,0,30778 -BRDA:234,1,1,931566 -DA:235,30778 -DA:236,30778 -DA:241,30778 -DA:243,30778 -DA:245,30778 -DA:247,30778 +FNDA:31134,ModuleManager._commitRemoveModule +DA:228,31134 +DA:230,31134 +DA:232,31134 +DA:233,31134 +DA:234,984421 +BRDA:234,1,0,31134 +BRDA:234,1,1,953287 +DA:235,31134 +DA:236,31134 +DA:241,31134 +DA:243,31134 +DA:245,31134 +DA:247,31134 FN:250,ModuleManager._ensureValidModule -FNDA:296456,ModuleManager._ensureValidModule -DA:251,296456 +FNDA:293615,ModuleManager._ensureValidModule +DA:251,293615 BRDA:251,2,0,6 -BRDA:251,2,1,296450 +BRDA:251,2,1,293609 DA:252,6 FN:256,ModuleManager._ensureNotModule -FNDA:296713,ModuleManager._ensureNotModule -DA:257,296713 +FNDA:293872,ModuleManager._ensureNotModule +DA:257,293872 BRDA:257,3,0,257 -BRDA:257,3,1,296456 +BRDA:257,3,1,293615 DA:258,257 FNF:12 FNH:11 @@ -2745,15 +2722,15 @@ end_of_record TN: SF:test/modules/fundingManager/token/utils/mocks/ElasticReceiptTokenBaseMock.sol FN:28,ElasticReceiptTokenBaseMock._supplyTarget -FNDA:6516,ElasticReceiptTokenBaseMock._supplyTarget -DA:34,6516 +FNDA:6507,ElasticReceiptTokenBaseMock._supplyTarget +DA:34,6507 FN:37,ElasticReceiptTokenBaseMock.mint FNDA:3338,ElasticReceiptTokenBaseMock.mint DA:38,3338 -DA:39,2942 +DA:39,2937 FN:42,ElasticReceiptTokenBaseMock.burn -FNDA:150,ElasticReceiptTokenBaseMock.burn -DA:43,150 +FNDA:149,ElasticReceiptTokenBaseMock.burn +DA:43,149 DA:44,0 FNF:3 FNH:3 @@ -2811,7 +2788,7 @@ SF:test/orchestrator/helper/TypeSanityHelper.sol FN:16,TypeSanityHelper.assumeElemNotInSet FNDA:8960,TypeSanityHelper.assumeElemNotInSet DA:20,8960 -DA:21,606736 +DA:21,600558 FN:29,TypeSanityHelper.assumeValidOrchestratorId FNDA:2048,TypeSanityHelper.assumeValidOrchestratorId DA:30,2048 @@ -2819,20 +2796,20 @@ FN:41,TypeSanityHelper.assumeValidModules FNDA:3072,TypeSanityHelper.assumeValidModules DA:42,3072 DA:43,3072 -DA:44,220262 -DA:47,220262 -DA:50,220262 +DA:44,220128 +DA:47,220128 +DA:50,220128 FN:54,TypeSanityHelper.assumeValidModule FNDA:1024,TypeSanityHelper.assumeValidModule -DA:55,221286 -DA:57,221286 -DA:58,663858 +DA:55,221152 +DA:57,221152 +DA:58,663456 FN:62,TypeSanityHelper.createInvalidModules FNDA:2,TypeSanityHelper.createInvalidModules -DA:63,221288 -DA:65,221288 -DA:66,221288 -DA:68,221288 +DA:63,221154 +DA:65,221154 +DA:66,221154 +DA:68,221154 FN:75,TypeSanityHelper.assumeValidFunders FNDA:0,TypeSanityHelper.assumeValidFunders FNF:6 @@ -2845,11 +2822,11 @@ end_of_record TN: SF:test/utils/mocks/ERC20Mock.sol FN:14,ERC20Mock.mint -FNDA:42048,ERC20Mock.mint -DA:15,42048 +FNDA:47034,ERC20Mock.mint +DA:15,47034 FN:18,ERC20Mock.burn -FNDA:25017,ERC20Mock.burn -DA:19,25017 +FNDA:25203,ERC20Mock.burn +DA:19,25203 FN:22,ERC20Mock.blockAddress FNDA:1,ERC20Mock.blockAddress DA:23,1 @@ -2861,32 +2838,32 @@ FNDA:2,ERC20Mock.toggleReturnFalse DA:31,2 FN:34,ERC20Mock.isBlockedAddress FNDA:2,ERC20Mock.isBlockedAddress -DA:35,99883 +DA:35,106554 FN:38,ERC20Mock.transfer -FNDA:10112,ERC20Mock.transfer -DA:39,10112 +FNDA:12384,ERC20Mock.transfer +DA:39,12384 BRDA:39,0,0,- -BRDA:39,0,1,10112 +BRDA:39,0,1,12384 DA:40,0 -DA:42,10112 +DA:42,12384 BRDA:42,1,0,- -BRDA:42,1,1,10112 -DA:43,10112 -DA:44,10112 -DA:45,10112 +BRDA:42,1,1,12384 +DA:43,12384 +DA:44,12384 +DA:45,12384 FN:48,ERC20Mock.transferFrom -FNDA:89770,ERC20Mock.transferFrom -DA:53,89770 +FNDA:94169,ERC20Mock.transferFrom +DA:53,94169 BRDA:53,2,0,1 -BRDA:53,2,1,89769 +BRDA:53,2,1,94168 DA:54,1 -DA:56,89769 +DA:56,94168 BRDA:56,3,0,1 -BRDA:56,3,1,89768 -DA:57,89768 -DA:58,89768 -DA:59,89768 -DA:60,89768 +BRDA:56,3,1,94167 +DA:57,94167 +DA:58,94167 +DA:59,94167 +DA:60,94167 FNF:8 FNH:8 LF:19 @@ -2897,12 +2874,12 @@ end_of_record TN: SF:test/utils/mocks/ERC721Mock.sol FN:15,ERC721Mock.mint -FNDA:1524,ERC721Mock.mint -DA:16,1524 -DA:17,1524 +FNDA:1750,ERC721Mock.mint +DA:16,1750 +DA:17,1750 FN:20,ERC721Mock.burn -FNDA:1780,ERC721Mock.burn -DA:21,1780 +FNDA:2006,ERC721Mock.burn +DA:21,2006 FN:24,ERC721Mock.blockAddress FNDA:0,ERC721Mock.blockAddress DA:25,0 @@ -2928,8 +2905,8 @@ end_of_record TN: SF:test/utils/mocks/factories/ModuleFactoryMock.sol FN:20,ModuleFactoryMock.createModule -FNDA:53171,ModuleFactoryMock.createModule -DA:24,53171 +FNDA:50555,ModuleFactoryMock.createModule +DA:24,50555 FN:27,ModuleFactoryMock.getBeaconAndId FNDA:0,ModuleFactoryMock.getBeaconAndId DA:32,0 @@ -3001,27 +2978,18 @@ BRDA:36,0,0,- BRDA:36,0,1,259 DA:38,259 DA:40,259 -DA:42,259 -FN:46,AuthorizerMock.mockInit +DA:41,259 +FN:44,AuthorizerMock.mockInit FNDA:256,AuthorizerMock.mockInit DA:46,256 DA:47,256 BRDA:47,1,0,- BRDA:47,1,1,256 DA:49,256 -BRDA:49,1,0,- -BRDA:49,1,1,256 -DA:51,256 -FN:58,AuthorizerMock.isAuthorized -FNDA:3844,AuthorizerMock.isAuthorized -DA:59,3844 -FN:65,AuthorizerMock.isAuthorized -FNDA:0,AuthorizerMock.isAuthorized -DA:70,0 -FN:77,AuthorizerMock.generateRoleId -FNDA:270630,AuthorizerMock.generateRoleId -DA:82,631516 -FN:85,AuthorizerMock.grantRoleFromModule +FN:75,AuthorizerMock.generateRoleId +FNDA:276893,AuthorizerMock.generateRoleId +DA:80,277661 +FN:83,AuthorizerMock.grantRoleFromModule FNDA:512,AuthorizerMock.grantRoleFromModule DA:84,512 DA:85,512 @@ -3045,11 +3013,16 @@ FNDA:0,AuthorizerMock.getRoleMemberCount DA:109,0 FN:112,AuthorizerMock.grantRole FNDA:0,AuthorizerMock.grantRole -DA:115,0 -FN:118,AuthorizerMock.hasRole -FNDA:628930,AuthorizerMock.hasRole -DA:119,628930 -FN:122,AuthorizerMock.checkRoleMembership +DA:113,0 +FN:116,AuthorizerMock.hasRole +FNDA:651003,AuthorizerMock.hasRole +DA:117,651003 +FN:120,AuthorizerMock.hasModuleRole +FNDA:0,AuthorizerMock.hasModuleRole +DA:125,0 +DA:126,0 +DA:127,0 +FN:130,AuthorizerMock.checkRoleMembership FNDA:512,AuthorizerMock.checkRoleMembership DA:135,512 FN:138,AuthorizerMock.revokeRole @@ -3057,13 +3030,13 @@ FNDA:0,AuthorizerMock.revokeRole DA:139,0 FN:142,AuthorizerMock.renounceRole FNDA:0,AuthorizerMock.renounceRole -FN:136,AuthorizerMock.getOwnerRole -FNDA:180054,AuthorizerMock.getOwnerRole -DA:137,180054 -FN:140,AuthorizerMock.getManagerRole -FNDA:178774,AuthorizerMock.getManagerRole -DA:141,178774 -FN:148,AuthorizerMock.grantGlobalRole +FN:144,AuthorizerMock.getOwnerRole +FNDA:190135,AuthorizerMock.getOwnerRole +DA:145,190135 +FN:148,AuthorizerMock.getManagerRole +FNDA:184757,AuthorizerMock.getManagerRole +DA:149,184757 +FN:156,AuthorizerMock.grantGlobalRole FNDA:0,AuthorizerMock.grantGlobalRole DA:157,0 DA:158,0 @@ -3087,8 +3060,8 @@ FN:35,ERC20PaymentClientMock.setOrchestrator FNDA:768,ERC20PaymentClientMock.setOrchestrator DA:36,768 FN:42,ERC20PaymentClientMock.addPaymentOrder -FNDA:91432,ERC20PaymentClientMock.addPaymentOrder -DA:43,91432 +FNDA:91286,ERC20PaymentClientMock.addPaymentOrder +DA:43,91286 FN:47,ERC20PaymentClientMock.addPaymentOrderUnchecked FNDA:5,ERC20PaymentClientMock.addPaymentOrderUnchecked DA:49,5 @@ -3100,11 +3073,11 @@ DA:58,1 FN:64,ERC20PaymentClientMock._ensureTokenBalance FNDA:3844,ERC20PaymentClientMock._ensureTokenBalance DA:68,3844 -BRDA:68,0,0,3464 +BRDA:68,0,0,3469 BRDA:68,0,1,3844 DA:69,3844 -DA:71,3464 -DA:72,3464 +DA:71,3469 +DA:72,3469 FN:76,ERC20PaymentClientMock._ensureTokenAllowance FNDA:3844,ERC20PaymentClientMock._ensureTokenAllowance DA:80,3844 @@ -3151,8 +3124,8 @@ FN:47,FundingManagerMock.withdrawTo FNDA:0,FundingManagerMock.withdrawTo DA:48,0 FN:51,FundingManagerMock.transferOrchestratorToken -FNDA:3049,FundingManagerMock.transferOrchestratorToken -DA:52,3049 +FNDA:3038,FundingManagerMock.transferOrchestratorToken +DA:52,3038 FNF:8 FNH:3 LF:8 @@ -3163,15 +3136,15 @@ end_of_record TN: SF:test/utils/mocks/modules/PaymentProcessorMock.sol FN:15,PaymentProcessorMock.processPayments -FNDA:11454,PaymentProcessorMock.processPayments +FNDA:11828,PaymentProcessorMock.processPayments FN:17,PaymentProcessorMock.cancelRunningPayments FNDA:0,PaymentProcessorMock.cancelRunningPayments FN:19,PaymentProcessorMock.token FNDA:0,PaymentProcessorMock.token DA:20,0 FN:23,PaymentProcessorMock.deleteAllPayments -FNDA:3049,PaymentProcessorMock.deleteAllPayments -DA:24,3049 +FNDA:3038,PaymentProcessorMock.deleteAllPayments +DA:24,3038 FNF:4 FNH:2 LF:2 @@ -3280,8 +3253,8 @@ FN:28,ModuleManagerMock.initNoInitializer FNDA:1,ModuleManagerMock.initNoInitializer DA:29,1 FN:32,ModuleManagerMock.__ModuleManager_isAuthorized -FNDA:108783,ModuleManagerMock.__ModuleManager_isAuthorized -DA:38,108783 +FNDA:110152,ModuleManagerMock.__ModuleManager_isAuthorized +DA:38,110152 FNF:5 FNH:4 LF:5 diff --git a/src/modules/logicModule/BountyManager.sol b/src/modules/logicModule/BountyManager.sol index a7a2c76ce..ce32b39cc 100644 --- a/src/modules/logicModule/BountyManager.sol +++ b/src/modules/logicModule/BountyManager.sol @@ -371,7 +371,7 @@ contract BountyManager is IBountyManager, ERC20PaymentClient { validClaimId(claimId) notClaimed(claimId) notLocked(_claimRegistry[claimId].bountyId) - onlyModuleRole(uint8(Roles.ClaimAdmin)) + onlyModuleRole(CLAIM_ADMIN_ROLE) { validContributorsForBounty( contributors, _bountyRegistry[_claimRegistry[claimId].bountyId] diff --git a/test/modules/logicModule/BountyManager.t.sol b/test/modules/logicModule/BountyManager.t.sol index 05c5793bb..a17b4a596 100644 --- a/test/modules/logicModule/BountyManager.t.sol +++ b/test/modules/logicModule/BountyManager.t.sol @@ -667,8 +667,7 @@ contract BountyManagerTest is ModuleTest { abi.encodeWithSelector( IModule.Module__CallerNotAuthorized.selector, _authorizer.generateRoleId( - address(bountyManager), - uint8(IBountyManager.Roles.ClaimAdmin) + address(bountyManager), bountyManager.CLAIM_ADMIN_ROLE() ), address(this) ) From ca3cf7a7072f7cf34643d2f7c37d04aa4343a197 Mon Sep 17 00:00:00 2001 From: 0xNuggan <82726722+0xNuggan@users.noreply.github.com> Date: Fri, 25 Aug 2023 12:28:37 +0200 Subject: [PATCH 32/32] Update .gitmodules --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 1386ebdb6..c90cdcbb4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "lib/forge-std"] path = lib/forge-std - url = https://github.com/foundry-r/forge-std + url = https://github.com/foundry-rs/forge-std [submodule "lib/openzeppelin-contracts"] path = lib/openzeppelin-contracts url = https://github.com/openzeppelin/openzeppelin-contracts