Repository navigation
fail-closed credit price on stale oracle - #26
Conversation
… (red) X21 / oracle v2 ADR (fed#745) consumer C9. BulkComputeGateway's currentCreditPriceUsd() view has no staleness check, and get_credit_price_usd returns it as is today: the stale, unset and unreadable cases return a price and the bound option does not exist (6 of 7 fail). Signed-off-by: Larry Klosowski <larryklosowski@proton.me> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019cgBjEUXiPasw1yPyGXkXC
… oracle X21 / oracle v2 ADR (fed#745) section 5, consumer C9 (C5 view). BulkComputeGateway.currentCreditPriceUsd() returns the v1 compute price with no staleness check, so get_credit_price_usd now checks it first: the gateway's oracle(), that oracle's lastComputeUpdateBlock() and the block's timestamp. It raises the new PriceUnavailableError, and reads no price, when the compute price was never set by a committee round (block 0), is older than oracle_staleness_seconds on the local clock (new keyword, default DEFAULT_ORACLE_STALENESS_SECONDS = 900, owner 2026-11-30; a time bound, not v1's block-counted isPriceStale(), and the compute track only, not the shared lastUpdateBlock), or cannot be read. A 0 or negative bound is refused at construction. The existing decode test now answers the freshness reads (a block mined now) and asserts the price read comes last. pytest on the treasury modules 37 passed (local); ruff and mypy clean on the changed files. Signed-off-by: Larry Klosowski <larryklosowski@proton.me> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019cgBjEUXiPasw1yPyGXkXC
|
Independent review (Claude reviewer-K) @2d07eb07: APPROVE The data source is real (Rule 7), checked against citrate-chain main
Fails closed on every path, and the price is never read on a refusal.
The default of 900 s is one named constant. Tests.
nb (not blocking). The same nb as on sdk-marketplace#23:
Not using the approve button and not merging. |
BerryManifold
left a comment
There was a problem hiding this comment.
Automated Codex static review of 2d07eb0797c94ac845e1717c809f6ec13f2252bb is complete. Result: blockers; details retained privately. Details and coverage limits are recorded in the project's private review log. No tests were executed by this reviewer. Both account submissions represent the same Codex review, not independent reviews.
Matr0xshka
left a comment
There was a problem hiding this comment.
Automated Codex static review of 2d07eb0797c94ac845e1717c809f6ec13f2252bb is complete. Result: blockers; details retained privately. Details and coverage limits are recorded in the project's private review log. No tests were executed by this reviewer. Both account submissions represent the same Codex review, not independent reviews.
Summary
X21 (0.6.0 x TOK1B crosswalk) and the oracle v2 ADR (citrate-federation#745) section 5, consumer C9 (the C5 view):
TreasuryManager.get_credit_price_usdnever returns a price from a stale or unset oracle.BulkComputeGateway.currentCreditPriceUsd()returnsoracle.computePriceUsdCents() * 10_000with no staleness check. So before reading it, the manager:oracle(), then that oracle'slastComputeUpdateBlock()(the view reads only the compute track);oracle_staleness_secondsold on the local clock. The new keyword defaults toDEFAULT_ORACLE_STALENESS_SECONDS= 900 (owner value, 2026-11-30). It is a time bound, not v1's block-countedisPriceStale(), and it is per track, not the sharedlastUpdateBlock;PriceUnavailableError(aCitrateError, exported) on any refusal, including an unreadable view or block, and reads no price.A 0 or negative
oracle_staleness_secondsraisesConfigurationErrorat construction. At the TOK1B reroll, v2's credit price view reverts when stale and this bridge maps that revert to the same error.Tests
tests/test_treasury_stale_price.py, 6 of 7 failing on main.test_get_credit_price_usd_decodenow answers the freshness reads (a block mined now) and asserts that the price read is the last call. No assertion was dropped.Review record
Money path (pricing): one independent review requested in the swarm review queue.
🤖 Generated with Claude Code
https://claude.ai/code/session_019cgBjEUXiPasw1yPyGXkXC