Skip to content

feat(oracle): wire corporate-action auto-pause into BasePythOracleAdapter (RAI-320)#23

Open
hardyjosh wants to merge 1 commit into
feat/lib-corporate-actions-pausefrom
feat/auto-pause-base-adapter
Open

feat(oracle): wire corporate-action auto-pause into BasePythOracleAdapter (RAI-320)#23
hardyjosh wants to merge 1 commit into
feat/lib-corporate-actions-pausefrom
feat/auto-pause-base-adapter

Conversation

@hardyjosh

Copy link
Copy Markdown
Collaborator

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 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.

@linear

linear Bot commented May 9, 2026

Copy link
Copy Markdown

RAI-320

@coderabbitai

coderabbitai Bot commented May 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e64b75eb-be50-42dd-a2cf-d879ba5d3520

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/auto-pause-base-adapter

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

hardyjosh commented May 9, 2026

Copy link
Copy Markdown
Collaborator Author

@hardyjosh hardyjosh force-pushed the feat/lib-corporate-actions-pause branch from 384c2c9 to ac0cecc Compare May 9, 2026 11:51
@hardyjosh hardyjosh force-pushed the feat/auto-pause-base-adapter branch from 4c711c5 to 140fb0f Compare May 9, 2026 11:51
@hardyjosh hardyjosh force-pushed the feat/lib-corporate-actions-pause branch from ac0cecc to b9aca8c Compare May 9, 2026 12:08
@hardyjosh hardyjosh force-pushed the feat/auto-pause-base-adapter branch 2 times, most recently from 4eb86c3 to 9093228 Compare May 9, 2026 12:21
@hardyjosh hardyjosh force-pushed the feat/auto-pause-base-adapter branch 2 times, most recently from 5f986f2 to d538ab2 Compare May 11, 2026 21:22
@hardyjosh hardyjosh force-pushed the feat/lib-corporate-actions-pause branch from b9aca8c to 6c0d395 Compare May 11, 2026 21:22
@hardyjosh hardyjosh force-pushed the feat/auto-pause-base-adapter branch from d538ab2 to b26969b Compare May 11, 2026 22:27
@hardyjosh hardyjosh force-pushed the feat/auto-pause-base-adapter branch from b26969b to 73f1220 Compare May 26, 2026 17:35
@hardyjosh hardyjosh force-pushed the feat/lib-corporate-actions-pause branch from 6c0d395 to 8116e4f Compare May 26, 2026 17:35
@hardyjosh hardyjosh force-pushed the feat/lib-corporate-actions-pause branch from 8116e4f to 74112b9 Compare May 26, 2026 18:15
@hardyjosh hardyjosh force-pushed the feat/auto-pause-base-adapter branch from 73f1220 to 2ed0a7f Compare May 26, 2026 18:15
…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.
@hardyjosh hardyjosh force-pushed the feat/lib-corporate-actions-pause branch from 74112b9 to fd0d3ec Compare May 31, 2026 11:48
@hardyjosh hardyjosh force-pushed the feat/auto-pause-base-adapter branch from 2ed0a7f to 4b1991a Compare May 31, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant