Oracle

This price data broadcasted by approved announcers is used to feed the oracle coin. The coin puzzle is a standard singleton that stores

  • a list of price data,

  • a list of temporarily banned announcers, and

  • data for outlier resolution.

The list contains pairs of prices and timestamps, with the oldest data at its head. A price is considered matured to the protocol when it has outlived the STATUTE_PRICE_DELAY protocol parameter. When new prices are added, all immature prices are kept; but only the newest mature price is retained.

Given this price data, the oracle's other primary responsibility is to announce them to the protocol (and other protocols). When an oracle is spent for an announcement, the spender can decide what prices are regarded as mature by providing a price delay. For example, the most recent price can be obtained by announcing with a delay of 0.

When oracle data is consumed by the protocol, it is enforced by other puzzles that the provided price delay matches the STATUTE_PRICE_DELAY parameter.

Mutation

In the normal course of operation, any user may add a new price once the latest price is sufficiently old (past the PRICE_UPDATE_DELAY). This is done by selecting enough unique approved announcers and providing their prices. The oracle checks via announcement that these announcers indeed announce the given prices.

The current timestamp and the provided prices are added to the list. Additionally, all matured prices except the most recent are removed.

If a substantial price deviation is detected, the oracle will enter an outlier resolution state. The price data is not updated and the oracle will not announce prices.

Outlier resolution

The coin is in the outlier resolution mode when OUTLIER_INFO is set. This parameter contains both voting state and the proposed price data that triggered the resolution.

The outlier voting mechanics are similar to the governance proposal process. Each proposed decision is associated with an amount of previously locked CRT. A resolution decision from a coin with more locked CRT replaces the previous decision.

Correctness and test coverage

While most functionality is covered by the existing test suite, we notice that the outlier resolution process does not have sufficient test coverage. As with the other components, negative test cases on the effects of spend conditions would additionally ensure correctness.

Zellic © 2025Back to top ↑