feat(oracle): wire corporate-action auto-pause into BasePythOracleAdapter (RAI-320)#23
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 |
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
384c2c9 to
ac0cecc
Compare
4c711c5 to
140fb0f
Compare
ac0cecc to
b9aca8c
Compare
4eb86c3 to
9093228
Compare
5f986f2 to
d538ab2
Compare
b9aca8c to
6c0d395
Compare
d538ab2 to
b26969b
Compare
b26969b to
73f1220
Compare
6c0d395 to
8116e4f
Compare
8116e4f to
74112b9
Compare
73f1220 to
2ed0a7f
Compare
…pter (RAI-320) Implements SPEC § 16. Both PythOracleAdapter and MultiPythOracleAdapter inherit auto-pause behaviour through the shared base. Storage on BasePythOracleAdapter (immutable post-init): * corporateActionsVault — address implementing ICorporateActionsV1 (zero disables) * actionTypeMask — bitmap of action types that trigger a pause * pauseTimeBefore / pauseTimeAfter — window around an action's effectiveTime _validateNotPaused now checks both: 1. The manual paused flag (cheap SLOAD, takes precedence) → reverts OraclePausedManual 2. LibCorporateActionsPause.inPauseWindow on the configured vault → reverts OraclePausedCorporateAction(uint64 effectiveTime) OraclePaused is removed. Distinct error selectors let integrators disambiguate via static-call introspection or simulation. The breaking-change implications are flagged for the migration plan (RAI-323). Both adapter Config structs gain a CorporateActionPauseConfig pauseConfig field. All-zero is the legacy/manual-only mode. The OracleUnifiedDeployer and MultiOracleUnifiedDeployer pass through an empty pauseConfig for now — RAI-322 extends their signatures to accept the four fields. Existing callers see no behaviour change. 7 new adapter-level tests in PythOracleAdapter.autoPause.t.sol exercise the wiring against the shared `test/mocks/MockCorporateActions.sol` stub introduced in PR #22: zero-vault short-circuit, pending/completed in-window reverts on both latestAnswer and latestRoundData, manual-pause precedence, and that lifting the manual flag re-surfaces the auto-pause error. Algorithm correctness lives in the lib's tests (PR #22 RAI-319). Additional coverage for the VaultSharePriceOverflow revert path on `latestAnswer` (audit #52): exercises the int256-overflow guard when `basePrice * totalAssets / totalSupply` exceeds int256.max, ensuring the explicit revert selector is surfaced unchanged. The shared mock returns the documented NODE_NONE = type(uint256).max sentinel on no-match (matching the real ICorporateActionsV1 contract), so the adapter-level tests exercise the same code path as production. Existing tests are migrated to the new config shape via a default-empty pauseConfig helper on each test fixture; OraclePaused selectors are renamed to OraclePausedManual. Closes #52.
74112b9 to
fd0d3ec
Compare
2ed0a7f to
4b1991a
Compare

Implements SPEC § 16. Both PythOracleAdapter and MultiPythOracleAdapter inherit auto-pause behaviour through the shared base.
Storage on BasePythOracleAdapter (immutable post-init):
_validateNotPaused now checks both:
OraclePaused is removed. Distinct error selectors let integrators disambiguate via static-call introspection or simulation. The breaking-change implications are flagged for the migration plan (RAI-323).
Both adapter Config structs gain a CorporateActionPauseConfig pauseConfig field. All-zero is the legacy/manual-only mode.
The OracleUnifiedDeployer and MultiOracleUnifiedDeployer pass through an empty pauseConfig for now — RAI-322 extends their signatures to accept the four fields. Existing callers see no behaviour change.
7 new adapter-level tests in PythOracleAdapter.autoPause.t.sol exercise the wiring against a MockCorporateActions stub: zero-vault short-circuit, pending/completed in-window reverts on both latestAnswer and latestRoundData, manual-pause precedence, and that lifting the manual flag re-surfaces the auto-pause error. Algorithm correctness lives in the lib's tests (PR for RAI-319).
Existing tests are migrated to the new config shape via a default-empty pauseConfig helper on each test fixture; OraclePaused selectors are renamed to OraclePausedManual.