Walking Chainlink price history across an aggregator replacement

A backfill reaches the earliest round from the feed’s current aggregator. Subtracting one from the proxy round ID does not jump to the previous aggregator’s last report.

Unpack the proxy round identifier

For this EVM proxy format, the high bits identify the phase and the low 64 bits identify the round inside that aggregator. The example starts with phase 3, round 1. Subtracting one still produces phase 3, now with a local round number of zero. Keep the identifier as an integer large enough for 80 bits.

const pack = (phase, round) => (phase << 64n) | round;
const id = pack(3n, 1n);
console.log(String(id >> 64n), String(id & ((1n << 64n) - 1n)));
console.log(String((id - 1n) >> 64n));

Resume from an observed round in the older phase

Find the aggregator associated with phase 2 in the proxy history and establish its final round from historical records for that phase. Combine that known local round with phase 2 before querying the proxy. Record both the proxy and the phase in your dataset: the local round number alone can occur under multiple aggregators. Report unresolved intervals explicitly when historical calls fail.

docs.chain.link Historical feed rounds