refactor: reduce PaymasterHub bytecode via library extraction#133
Merged
refactor: reduce PaymasterHub bytecode via library extraction#133
Conversation
…solidation Extract errors, events, and business logic into four specialized libraries to reduce PaymasterHub from 25,434 bytes (858 over limit) to 24,030 bytes (546 under limit), while improving code organization and maintainability. Changes: - PaymasterHubErrors: all 38 errors and 22 events with full NatSpec - PaymasterGraceLib: grace period checks and solidarity tier matching - PaymasterPostOpLib: budget adjustments and clamped deductions - PaymasterCalldataLib: execute() envelope validation and selector extraction Additional optimizations: - Remove RULE_ID_EXECUTOR (identical to RULE_ID_COARSE, created SDK confusion) - Remove totalDeposited field from OrgFinancials (no on-chain readers, event history sufficient) - Move getOrgGraceStatus view function to PaymasterHubLens - Consolidate duplicate _validateBatchRules loop bodies - Extract _setRulesBatch internal helper to deduplicate rule-setting code All 1089 tests pass. Contract is production-ready under size limit. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Contributor
Coverage Report
Coverage by file
|
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
Extract errors, events, and business logic into four specialized libraries to reduce PaymasterHub from 25,434 bytes (858 over limit) to 24,030 bytes (546 under limit), while improving code organization and maintainability.
Changes
Optimizations
Test Plan
🤖 Generated with Claude Code