Make latest_round accept one or many data ids - #182
Draft
Fletch153 wants to merge 1 commit into
Draft
Conversation
Soroban Contract Test Coverage92.64% line coverage — 18001 / 19431 lines hit
Per-Contract Breakdown
Full file-level coverage report |
Fletch153
force-pushed
the
feature/DF-25429/latest-rounds-bulk-read
branch
from
August 14, 2026 13:47
d1225b0 to
ab78953
Compare
The DON transmitter reads every feed's latest state each round to gate on deviation and heartbeat; single-feed reads would cost one consensus call per feed. latest_round now takes a Vec of ids and returns one element per id: Round(data), Frozen(data), or None. Page sizing is the caller's concern; the host's own budget and footprint limits bound oversized calls either way. Freeze enforcement moves wholly to the proxy: cache readers serve raw data (freezing blocks consumer reads, not DON writes, and the transmitter needs frozen feeds' state to keep writing them), while the proxy turns the Frozen marker or an is_frozen check into the same FeedFrozen failure consumers saw before. Self-upgrade wasm fixtures are rebuilt from the new interface.
Fletch153
force-pushed
the
feature/DF-25429/latest-rounds-bulk-read
branch
from
August 14, 2026 13:58
ab78953 to
19ae96a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
latest_roundnow takes aVecof data ids and returns one element per id (Round(data),Frozen(data), orNone), so the DON transmitter reads its whole feed book in one consensus call; a single-feed read is a one-element vec.FeedFrozenfailure consumers saw before.Context
The CRE transmitter workflow reads every feed's latest answer and timestamp each round to gate writes on deviation and heartbeat. The cache only exposed single-feed getters, and the CRE platform budgets chain reads per workflow execution, so per-feed reads put a low ceiling on the feed count. Two principles drive the shape: one read path for one or many feeds rather than parallel singular and plural functions, and freezing as consumer policy rather than storage policy. Freezing exists to stop consumers reading a feed, not to stop the DON writing it, and the transmitter needs frozen feeds' state to keep gating correctly, so the cache returns raw data and the consumer-facing proxy enforces the freeze. Page sizing is deliberately left to the caller: the host's own CPU budget and footprint limits bound oversized calls on every network, and an on-chain cap constant would only go stale as those limits evolve. Sizing was validated empirically on testnet (simulation enforces the CPU budget at roughly six hundred trivial entry reads per call; the strictest environment observed, the unit-test host, allows 100 footprint entries), so realistic pages are comfortably safe and the adapter chunks larger books.
Changes
latest_round(Vec<BytesN<16>>) -> Result<Vec<LatestRound>, CacheError>replaces the singular getter; the newLatestRoundenum carriesRound/Frozen/Noneper feed so one call serves both the DON (data regardless of freeze) and the proxy (freeze signal without a second call).RoundDataitself is untouched: it is a stored type on live deployments, and freeze is feed-level state, not a property of a round.get_round,round_range,find_round,decimals, anddescriptionno longer reject frozen feeds; the cache is now purely raw storage access plus theis_frozenflag.Frozento the pre-existingFeedFrozencontract error onlatest_round, and prefixes the other read methods with anassert_not_frozencheck doing the same, so the consumer surface is wire-identical to before.Testing
Notes