-
Notifications
You must be signed in to change notification settings - Fork 2
Feat/shared script utilities #50
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
Conversation
- DeployUtils: shared _SWAP_FACILITY constant - ChainsBase: shared ETHEREUM/ETHEREUM_SEPOLIA chain IDs and isHub() - TimelockBatchBase: timelock batch transaction utility Consolidates duplicated script constants and utilities from m-portal, m-portal-lite, and evm-m-extensions.
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 consolidates shared script utilities to be reused across multiple M0 protocol repositories. It introduces base contracts and libraries for common deployment, timelock batching, and chain identification functionality, along with dependency updates.
Changes:
- Adds three new utility contracts:
TimelockBatchBasefor timelock batch operations,DeployUtilsfor shared deployment constants, andChainsBasefor EVM chain ID management - Updates submodule dependencies for
forge-std,safe-utils, and adds newopenzeppelin-contractssubmodule
Reviewed changes
Copilot reviewed 7 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| script/TimelockBatchBase.sol | Implements base contract for building and simulating timelock batch operations |
| script/DeployUtils.sol | Defines shared deployment constant for swap facility address |
| script/ChainsBase.sol | Provides library with common chain IDs and hub chain identification |
| lib/safe-utils | Updates safe-utils submodule to newer commit |
| lib/openzeppelin-contracts | Adds openzeppelin-contracts as new submodule dependency |
| lib/forge-std | Updates forge-std submodule to newer commit |
| .gitmodules | Registers openzeppelin-contracts submodule configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| (bool success, ) = _timelockTargets[i].call{ value: _timelockValues[i] }(_timelockPayloads[i]); | ||
| require(success, "Simulation failed"); |
Copilot
AI
Feb 6, 2026
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.
The error message 'Simulation failed' is too generic and doesn't provide information about which call failed or why. Consider including the target address and index in the error message to aid debugging.
| (bool success, ) = _timelockTargets[i].call{ value: _timelockValues[i] }(_timelockPayloads[i]); | ||
| require(success, "Simulation failed"); |
Copilot
AI
Feb 6, 2026
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.
The low-level call does not capture or handle the return data when the call fails. Consider capturing the return data to provide more context about failures, especially since this is a simulation function meant for testing.
| (bool success, ) = _timelockTargets[i].call{ value: _timelockValues[i] }(_timelockPayloads[i]); | |
| require(success, "Simulation failed"); | |
| (bool success, bytes memory returndata) = | |
| _timelockTargets[i].call{ value: _timelockValues[i] }(_timelockPayloads[i]); | |
| if (!success) { | |
| if (returndata.length > 0) { | |
| // Bubble up revert reason from the called contract | |
| assembly { | |
| revert(add(returndata, 32), mload(returndata)) | |
| } | |
| } else { | |
| revert("Simulation failed"); | |
| } | |
| } |
CI workflows set FOUNDRY_PROFILE=ci but the profile was not defined, causing build and coverage jobs to fail.
Foundry's auto-discovered remapping pointed to the safe-smart-account repo root, but sources live under contracts/. This caused CI build failures for safe-utils imports
Changes to gas cost
🧾 Summary (20% most significant diffs)
Full diff report 👇
|
LCOV of commit
|
JPMora89
left a comment
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.
LGTM, error message suggested by copilot not relevant as we would have other layers give us necessary info.
Base changes to consolidate shared script utilities across other repos.