-
Notifications
You must be signed in to change notification settings - Fork 19
Bytecode squeeze #658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: istaking-module-v2-csm
Are you sure you want to change the base?
Bytecode squeeze #658
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR extracts function bodies from the main contracts into dedicated external libraries to reduce bytecode size. The refactoring moves complex logic into reusable library functions while maintaining the same functionality.
Changes:
- Extracted queue cleaning, operator management, and deposit data processing logic into separate libraries
- Updated copyright year from 2025 to 2026 across modified files
- Removed redundant test cases for queue operations that now return early instead of reverting
- Moved constant definitions to interface files for better organization
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/WithdrawnValidatorLib.sol | Updated copyright year and added validation logic previously in BaseModule |
| src/lib/TopUpDepositDataLib.sol | New library extracting top-up deposit data processing logic |
| src/lib/OperatorTracker.sol | New library for tracking operator creators in transient storage |
| src/lib/OperatorDepositableChangeLib.sol | New library handling operator depositable count changes |
| src/lib/NodeOperatorLib.sol | New library containing node operator management functions |
| src/lib/DepositQueueLib.sol | Removed clean function moved to dedicated library |
| src/lib/DepositQueueCleanLib.sol | New library containing deposit queue cleaning logic |
| src/interfaces/IStakingModule.sol | Added constant definition for forced target limit mode |
| src/abstract/BaseModule.sol | Refactored to use new library functions, updated imports |
| src/CSModule.sol | Refactored to use new library functions for queue operations |
| test/unit/lib/DepositQueueLib.t.sol | Removed test for maxItems zero revert case |
| test/unit/CSModule.t.sol | Added test verifying early return when maxItems is zero |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@codex Review, pls! |
|
Codex Review: Didn't find any major issues. Keep it up! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Description
Extract function bodies to external libraries. Applying byte code saving tricks here and there.
Affected functions:
getNodeOperatorSummaryobtainDepositData(top-ups)cleanDepositQueuecreateNodeOperatorreportWithdrawnValidators_onOperatorDepositableChange_setTargetLimitChecklist
just coverage)