Skip to content

Oracle hooks and V3 adapters: review notes #143

Description

@luiz-lvj

Grouping a set of observations about the oracle hooks (BaseOracleHook, OracleHookWithV3Adapters) and the V3 adapters in one place, for tracking and to reduce duplicate reports. Items are summarized briefly and are not all confirmed. No severity is assigned here.

  • Truncated clamp convergence — The truncated observation clamp updates only when an observation is persisted (at most once per block), so after a large tick move with no further writes the truncated value can stay near the pre-move tick.
  • Adapter deployment on each initializationOracleHookWithV3Adapters._afterInitialize deploys and stores new adapters on every initialization, which permits repeated, unreclaimable storage growth on a shared hook.
  • Permissionless cardinality growthincreaseObservationCardinalityNext pre-writes each newly added observation slot, so buffers across many pools can be grown to expand shared hook storage.
  • Slot0-based observations under swap-overriding hooks — Observations use slot0.tick, which may not reflect executed price when composed with hooks that settle swaps via returned deltas.
  • Stubbed adapter fields — The V3 adapters return secondsPerLiquidityCumulativeX128 = 0, hardcode unlocked = true, and expose a raw (untruncated) spot tick alongside truncated cumulatives; consumers relying on these fields may behave unexpectedly, and the documentation presents broader V3 compatibility than these stubs provide.
  • observe on an unknown poolBaseOracleHook.observe does not guard against an uninitialized pool id, so a non-zero secondsAgos can reach a modulo-by-zero and panic, unlike increaseObservationCardinalityNext which reverts explicitly.
  • secondsAgos memory overhead — The adapters copy an unused returned array and allocate an unused placeholder, increasing memory per element and lowering the length at which calls run out of gas.
  • Adapter compositionOracleHookWithV3Adapters._afterInitialize passes zero for sender/sqrtPriceX96 to super and is not virtual, which limits re-use and composition by derived hooks.

Sources: src/oracles/panoptic/BaseOracleHook.sol, src/oracles/panoptic/OracleHookWithV3Adapters.sol, src/oracles/panoptic/adapters/.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions