Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GRNT-1112: include additional block time in the staleness check #3

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion contracts/pyth-store-v2.clar
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
(define-constant ERR_INVALID_UPDATES (err u5003))
(define-constant ERR_RESTRICTED_TO_TESTNET (err u5004))

(define-constant STACKS_BLOCK_TIME u5)

(define-map prices (buff 32) {
price: int,
conf: uint,
Expand Down Expand Up @@ -79,7 +81,7 @@
;; Ensure that we have not processed a newer price
(asserts! (is-price-update-more-recent (get price-identifier entry) (get publish-time entry)) ERR_NEWER_PRICE_AVAILABLE)
;; Ensure that price is not stale
(asserts! (>= (get publish-time entry) (- latest-bitcoin-timestamp stale-price-threshold)) ERR_STALE_PRICE)
(asserts! (>= (get publish-time entry) (+ (- latest-bitcoin-timestamp stale-price-threshold) STACKS_BLOCK_TIME)) ERR_STALE_PRICE)
;; Update storage
(map-set prices
(get price-identifier entry)
Expand Down