Repository navigation
feat(price-guard,common): return age of LastGood price when status is Degraded or Halted (#102) - #1123
Open
jeffrey-graham wants to merge 1 commit into
Open
feat(price-guard,common): return age of LastGood price when status is Degraded or Halted (#102)#1123jeffrey-graham wants to merge 1 commit into
jeffrey-graham wants to merge 1 commit into
Conversation
… Degraded or Halted (DevTobis#102)
jeffrey-graham
force-pushed
the
feat/issue-102-last-good-timestamp
branch
from
November 12, 2026 07:43
fea8de8 to
c265da4
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.
What and why
Closes #102
Previously
PriceGuard::evaluatereturnedts: nowon every branch, includingDegradedandHaltedevaluations that held and returnedlast_good, andDataKey::LastGoodstored only a barei128value without recording when that baseline was established. Off-chain monitors, lenders, and the console had no way to measure how stale the held fallback price was fromguarded_price()alone.This change:
LastGood { value: i128, ts: u64 }underDataKey::LastGood(Address)inPriceGuard, migrating pre-upgrade barei128entries viaVal+TryFromValwithts = 0until the nextOkevaluation orconfirm_halt_clearedwrites the structured value.ts = last_good.ts(0when no prior good price exists, orrolling_ref_tsif a rolling-reference halt ever falls back toreferencewithoutlast_good) onDegradedandHaltedevaluations, while keepingts = nowwhenstatus == PriceStatus::Ok.GuardedPrice::tsrustdoc incontracts/common/src/price.rsand documents theLastGood { value, ts }invariant incontracts/AUDIT_NOTES.md.Degraded,Halted,confirm_halt_cleared, and legacy bare-i128LastGoodmigration across simulated ledger time advances.Surfaces touched
contracts/services/orpackages/apps/console/packages/dbschema (migration committed)scripts/ordeploy/Checks run
pnpm build && pnpm typecheck && pnpm test(TypeScript changes)cd contracts && cargo test --workspace(contract changes)scripts/e2e-*.shagainst a running stack (on-chain behaviour orservices/apiroute changes), or say below why notCI on GitHub Actions is awaiting first-time contributor workflow approval. Ran locally:
cd contracts && cargo test --workspace→261 passed; 0 failed(ballast-price-guard: 67,ballast-common: 29,ballast-registry: 35,ballast-credit-line: 30,ballast-exit-desk: 23,ballast-pledge-vault: 23,ballast-repo-dvp: 52,ballast-integration-tests: 2)wasm32v1-nonerelease build →ballast_price_guard.wasmis84,724bytes (82.7 KiB), within the102,400-byte (100.0 KiB) budget across all 6 deployable contractsscripts/check-no-mocks.shandfor f in scripts/*.sh; do bash -n "$f"; done→ passed (scripts/check-docker-context.shskipped locally because Docker is not installed on this host)scripts/e2e-*.shnot run locally (no local Soroban/Postgres Docker stack running; covered byPriceGuardunit tests acrossOk→Degraded→Halted→confirm_halt_clearedand bare-i128storage migration).Checklist
*.test.ts/__fixtures__/.env.examplewith a commentCreditLine,PledgeVault,RepoDvPorPriceGuard, the reasoning is in the description andcontracts/AUDIT_NOTES.mdis updated if an assumption changed