Skip to content

feat(lazer/stellar): reject non-newer prices in example consumer#130

Merged
jayantk merged 1 commit into
mainfrom
hydra/i-uuoykatg/work
Jul 8, 2026
Merged

feat(lazer/stellar): reject non-newer prices in example consumer#130
jayantk merged 1 commit into
mainfrom
hydra/i-uuoykatg/work

Conversation

@jayantk

@jayantk jayantk commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

The Stellar example consumer contract now enforces a monotonic freshness check when updating the price: an update is rejected unless its feed timestamp is strictly greater than the currently stored price's timestamp.

Previously update_price would overwrite the stored price with any update that passed the age-based freshness threshold, so an out-of-order update carrying an older feed timestamp could clobber a newer stored price. The new check reads the currently stored price and returns a new Error::PriceOutdated (code 9) if the incoming feed timestamp is not strictly newer, leaving the stored price untouched.

  • lazer/stellar/src/lib.rs: added the strictly-newer-timestamp guard before storing.
  • lazer/stellar/src/error.rs: added the PriceOutdated error variant.
  • lazer/stellar/README.md: documented the monotonic-update guarantee.

Verified from lazer/stellar/: cargo fmt --all --check, cargo clippy --all-targets -- -D warnings, and cargo build --release --target wasm32v1-none all pass.

Enforce a monotonic freshness check in the Stellar example consumer:
update_price now rejects an update unless its feed timestamp is strictly
greater than the currently stored price's timestamp, returning the new
Error::PriceOutdated and leaving the stored price untouched otherwise.
This prevents an out-of-order update that still passes the age-based
freshness threshold from clobbering a newer stored price.
@jayantk jayantk merged commit 418d9d9 into main Jul 8, 2026
6 checks passed
@jayantk jayantk deleted the hydra/i-uuoykatg/work branch July 8, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants