Skip to content

feat(monitors): detect ManagedOptimisticOracleV2 upgrades and adjust expiration messaging#4929

Open
Reinis-FRP wants to merge 1 commit intomasterfrom
reinis/fro-3-oo-monitor-bots-handle-expiration-time-for-new-moov2
Open

feat(monitors): detect ManagedOptimisticOracleV2 upgrades and adjust expiration messaging#4929
Reinis-FRP wants to merge 1 commit intomasterfrom
reinis/fro-3-oo-monitor-bots-handle-expiration-time-for-new-moov2

Conversation

@Reinis-FRP
Copy link
Contributor

Motivation

ManagedOptimisticOracleV2 is being upgraded to change how the dispute window works. In the upgraded version, expirationTime will mark the earliest time when an undisputed proposal can be settled, but proposals will remain disputable even after expirationTime as long as they haven't been settled yet. The monitor bot needs to detect this upgrade and adjust its messaging accordingly to avoid confusion.

Summary

  • Added managedOOV2PreUpgradeBlock configuration option to specify the block number before the upgrade
  • Implemented _detectManagedOOV2Upgraded() method that checks the EIP-1967 implementation slot and compares implementation addresses at different blocks
  • Modified proposal messages to show "can be settled after X (but remains disputable until settled)" for upgraded contracts instead of "will expire at X"
  • Added lazy initialization with caching for upgrade detection
  • Fully backward compatible - standard messaging is used when config is not provided

Details

The implementation detects upgraded ManagedOptimisticOracleV2 contracts by:

  1. Checking if the contract type is OptimisticOracleV2
  2. Reading the EIP-1967 implementation storage slot (0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc)
  3. Comparing the raw bytes32 implementation value at the current block vs the configured pre-upgrade block
  4. If they differ, the contract has been upgraded

The detection runs once on the first call to checkForProposals() and the result is cached for subsequent calls to avoid repeated RPC calls.

Testing

  • New unit tests created
  • All existing tests pass

Added 5 comprehensive tests covering all scenarios:

  • Uses standard message when managedOOV2PreUpgradeBlock is not configured
  • Uses standard message when implementation slot is empty (not a UUPS proxy)
  • Uses standard message when implementation has not changed (not upgraded)
  • Uses upgraded message when implementation has changed (upgraded)
  • Caches detection result and doesn't check again on subsequent calls

All tests passing (5 passing in 25s).

Issue(s)

Fixes #FRO-3

…expiration messaging

Adds detection for upgraded ManagedOptimisticOracleV2 contracts that have new dispute
window behavior where proposals can be disputed even after expirationTime until settled.

Changes:
- Add managedOOV2PreUpgradeBlock config option to specify pre-upgrade block number
- Implement _detectManagedOOV2Upgraded() to check EIP-1967 implementation slot
- Adjust proposal message from "will expire at X" to "can be settled after X (but
  remains disputable until settled)" for upgraded contracts
- Add lazy initialization with caching for upgrade detection
- Add 5 comprehensive tests covering all detection scenarios

The implementation is backward compatible - without the config, standard messaging is used.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
@linear
Copy link

linear bot commented Feb 5, 2026

Copy link
Contributor

@md0x md0x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! While porting this to mcp-otb, I considered adding an optional fast path: a managedOOV2UpgradeBlock config that simply checks currentBlock >= upgradeBlock without the EIP-1967 slot comparison.

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.

2 participants