feat(paymaster): add separate whitelistAdmin param to BondTreasuryPaymaster#106
Merged
feat(paymaster): add separate whitelistAdmin param to BondTreasuryPaymaster#106
Conversation
…master The BondTreasuryPaymaster constructor previously coupled DEFAULT_ADMIN_ROLE and WHITELIST_ADMIN_ROLE to the same 'admin' address. This made it impossible to assign whitelist management to an operational key (e.g. FLEET_OPERATOR) while keeping DEFAULT_ADMIN_ROLE on a multisig. Changes: - Add 'whitelistAdmin' as the second constructor parameter - When whitelistAdmin != admin, grant WHITELIST_ADMIN_ROLE to whitelistAdmin - Update deploy script to pass fleetOperator as whitelistAdmin - Update all test instantiations and add test_separateWhitelistAdmin - Update spec doc deployment example
LCOV of commit
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
BondTreasuryPaymasterconstructor previously coupledDEFAULT_ADMIN_ROLEandWHITELIST_ADMIN_ROLEto the sameadminaddress. This made it impossible to assign whitelist management to an operational key (e.g.FLEET_OPERATOR) while keepingDEFAULT_ADMIN_ROLEon a multisig at deployment time.Changes
BondTreasuryPaymaster.sol: AddwhitelistAdminas a new constructor parameter (2nd position). WhenwhitelistAdmin != admin, the constructor grantsWHITELIST_ADMIN_ROLEtowhitelistAdminin addition toadmin.DeploySwarmUpgradeableZkSync.s.sol: PassfleetOperatoraswhitelistAdminso the fleet operator getsWHITELIST_ADMIN_ROLEandNODL_ADMINretainsDEFAULT_ADMIN_ROLE.BondTreasuryPaymaster.t.sol: UpdateMockBondTreasuryPaymasterand all test instantiations. Addtest_separateWhitelistAdminto verify role separation.swarm-specification.md: Update deployment example.Motivation
During the ZkSync mainnet deployment, we discovered that the single
adminparameter forcedFLEET_OPERATORto receiveDEFAULT_ADMIN_ROLE(a security risk) orNODL_ADMINto receiveWHITELIST_ADMIN_ROLE(operationally impractical since it's a multisig). This fix allows proper separation of concerns at deployment time.Testing
All 55
BondTreasuryPaymasterTesttests pass.