feat: seed initial bond allowances in BondTreasuryPaymaster constructor#110
Merged
feat: seed initial bond allowances in BondTreasuryPaymaster constructor#110
Conversation
Add initialBondAllowances[] parameter parallel to initialWhitelistedUsers[] so each whitelisted user gets a non-zero bond allowance at deploy time, removing the need for a separate setUserBondAllowance tx after deployment. - BondTreasuryPaymaster: new uint256[] initialBondAllowances constructor arg, ArrayLengthMismatch error if arrays differ in length - DeploySwarmUpgradeableZkSync.s.sol: read FLEET_OPERATOR_BOND_ALLOWANCE env (defaults to BOND_QUOTA) and pass it to constructor - deploy_swarm_contracts_zksync.sh: export FLEET_OPERATOR_BOND_ALLOWANCE - Tests: 6 new tests covering constructor allowances, array mismatch reverts, and immediate usability; all 83 tests pass
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
Add
initialBondAllowances[]constructor parameter toBondTreasuryPaymaster, parallel to the existinginitialWhitelistedUsers[]. Each whitelisted user now receives a non-zerouserBondAllowanceat deploy time, eliminating the need for a separatesetUserBondAllowancetransaction after deployment.Problem
Previously, the constructor whitelisted users but left their
userBondAllowanceat zero. A separate admin call tosetUserBondAllowance()was required before any sponsored claims could work. This was both easy to forget and created a window where the user was whitelisted but unable to use sponsored bonds.Changes
BondTreasuryPaymaster.sol: Newuint256[] memory initialBondAllowancesconstructor arg (must matchinitialWhitelistedUserslength, enforced byArrayLengthMismatcherror). Allowances are set in the same loop that seeds the whitelist.DeploySwarmUpgradeableZkSync.s.sol: ReadsFLEET_OPERATOR_BOND_ALLOWANCEenv var (defaults toBOND_QUOTA) and passes it to the constructor.deploy_swarm_contracts_zksync.sh: ExportsFLEET_OPERATOR_BOND_ALLOWANCE(defaults toBOND_QUOTA).Testing