refactor(audit-low): style + refactor sweep — ~22 LOW findings#231
refactor(audit-low): style + refactor sweep — ~22 LOW findings#231hardyjosh wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
3fecffb to
6154ea4
Compare
65579be to
03a3149
Compare
03a3149 to
b1cf23a
Compare
1315d9c to
e404e74
Compare
e404e74 to
a0ad72a
Compare
02a9fe1 to
ee0133e
Compare
a0ad72a to
5678933
Compare
Bulk LOW-severity stylistic / refactor changes that have no behavioural risk: Style: - #114 #117 #122 #128 #131 #136 #137 #138 #139 #140 #141 #142 #143: project-namespaced remapping `st0x.oracle/=src/`; all internal imports rewritten to use it so the repo is consumable as a git submodule without remapping conflicts. - #134: LibProdDeploy.sol pragma pinned to =0.8.25. - #119: MultiZero*/InitializeMultiOracleFailed errors in MultiPythOracleAdapterBeaconSetDeployer renamed to match sibling deployer naming (ZeroImplementation, ZeroBeaconOwner, InitializeAdapterFailed). Refactors: - #127: file-level OnlyAdmin / ZeroAdmin / ZeroVault / ZeroRegistry / OracleNotFound hoisted to src/lib/LibOracleErrors.sol; 4 consumers updated (BasePythOracleAdapter, OracleRegistry, MorphoProtocolAdapter, PassthroughProtocolAdapter). - #130: OracleRegistry extracts _setOracle helper consumed by both setOracle and setOracleBulk. - #124: MultiPythOracleAdapter.initialize bound checks already centralised in _setFeeds — no further dedup required (PR #230 #41). - #125: MorphoProtocolAdapter.NonPositivePrice carries int256 price matching BasePythOracleAdapter. - #126: MorphoProtocolAdapter 1e28 magic number replaced with named constants derived from MORPHO_PRICE_SCALE and EXPECTED_ORACLE_DECIMALS (SCALE_MULTIPLIER = MORPHO_PRICE_SCALE / 10**EXPECTED_ORACLE_DECIMALS). - #115: BasePythOracleAdapter int256(price8) cast annotated with forge-lint disable + safety comment. - #123: MultiPythOracleAdapter._tryGetPrice local `p` → `fetchedPrice` (named-return is already `price`, so use a distinct name). - #133: LibCorporateActionsPause local `vault` → `corporateActions` to avoid shadowing the priced-vault meaning; also documents the discarded tuple-return placeholder. - #200: LibCorporateActionsPause adds defensive `effectiveTime != 0` belt-and-suspenders on top of the NODE_NONE cursor check in both pre- and post-window branches. Storage hardening (#116, #218): - BasePythOracleAdapter storage groups separated by comment banners ("mutable governance" vs "immutable-after-init corporate-action config" vs "reserved slots"); ends with a `uint256[50] __gap` reserved-slot array so future base additions don't shift subclass slots. Subclass slot positions shift one-time by 50; safe because no live deployment exists. Adds vm.load-based storage layout test pinning `vault` at slot 0 and `MultiPythOracleAdapter.feedCount` at the post-gap slot 55. forge build, forge fmt --check, slither (0 results), and REUSE all green. Test count delta: 147 → 148 (+1, the new storage layout test). No behaviour change to user-visible APIs beyond NonPositivePrice(int256) shape change and storage layout (documented above). Closes #114, #115, #116, #117, #119, #122, #123, #124, #125, #126, Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
5678933 to
a57f73a
Compare
ee0133e to
735cfde
Compare
|
Storage |

Bulk LOW-severity stylistic / refactor changes that have no behavioural
risk:
Style:
project-namespaced remapping
st0x.oracle/=src/; all internalimports rewritten to use it so the repo is consumable as a git
submodule without remapping conflicts.
MultiPythOracleAdapterBeaconSetDeployer renamed to match sibling
deployer naming (ZeroImplementation, ZeroBeaconOwner,
InitializeAdapterFailed).
Refactors:
OracleNotFound hoisted to src/lib/LibOracleErrors.sol; 4 consumers
updated (BasePythOracleAdapter, OracleRegistry, MorphoProtocolAdapter,
PassthroughProtocolAdapter).
setOracle and setOracleBulk.
centralised in _setFeeds — no further dedup required (PR fix(audit-low): code-correctness sweep — 10 LOW findings in one pass #230 [A09-2] [LOW] MultiPythOracleAdapter.setFeeds reuses _setFeeds wipe-then-write pattern that leaks gas on shrink without bounding cost #41).
matching BasePythOracleAdapter.
constants derived from MORPHO_PRICE_SCALE and EXPECTED_ORACLE_DECIMALS
(SCALE_MULTIPLIER = MORPHO_PRICE_SCALE / 10**EXPECTED_ORACLE_DECIMALS).
forge-lint disable + safety comment.
p→fetchedPrice(named-return is already
price, so use a distinct name).vault→corporateActionsto avoid shadowing the priced-vault meaning; also documents the
discarded tuple-return placeholder.
effectiveTime != 0belt-and-suspenders on top of the NODE_NONE cursor check in both
pre- and post-window branches.
Storage hardening (#116, #218):
("mutable governance" vs "immutable-after-init corporate-action
config" vs "reserved slots"); ends with a
uint256[50] __gapreserved-slot array so future base additions don't shift subclass
slots. Subclass slot positions shift one-time by 50; safe because
no live deployment exists. Adds vm.load-based storage layout test
pinning
vaultat slot 0 andMultiPythOracleAdapter.feedCountatthe post-gap slot 55.
forge build, forge fmt --check, slither (0 results), and REUSE all
green. Test count delta: 147 → 148 (+1, the new storage layout test).
No behaviour change to user-visible APIs beyond
NonPositivePrice(int256) shape change and storage layout (documented
above).
Closes #114, #115, #116, #117, #119, #122, #123, #124, #125, #126,
#127, #128, #130, #131, #133, #134, #136, #137, #138, #139, #140,
#141, #142, #143, #200, #218.
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com