Document price precision and TWAP aggregation on submit_price - #270
Merged
Jaydbrown merged 1 commit intoJul 29, 2026
Merged
Conversation
Addresses conduit-protocol#219. submit_price already had a short doc comment, but it did not explain the expected price precision/decimals or how submissions feed into TWAP aggregation, which was the real gap behind the issue. Added: - price is a fixed-point integer scaled by 10^decimals, where decimals comes from OracleConfig (max 38, validated in configure_oracle). Documented with a concrete example. - Clarified there is no fixed time-bucketed TWAP window: each feeder's latest submission is kept independently, and get_twap_price aggregates the median (or average of the two middle values on an even count) across submissions within max_staleness seconds of current ledger time. - Cross-referenced calculate_fiat_stream_payout, which divides by 10^decimals, to make clear submissions must match the currently configured decimals scale. No behavior change — doc comment only. cargo build, cargo test (42 passed), cargo fmt --check, and cargo clippy all clean on the oracle crate.
|
@Alimzy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Note on scope
The issue states submit_price has no doc comment. It actually already
had a short one — but it didn't cover price precision/decimals or how
submissions feed into TWAP aggregation, which is the real gap this PR
addresses.
What this PR does
Extends submit_price's existing doc comment with:
comes from the oracle's OracleConfig (max 38, validated in
configure_oracle), with a concrete example (decimals: 8 -> 100.0 is
submitted as 100_00000000).
every feeder's latest submission is kept independently, and
get_twap_price aggregates the median (or average of the two middle
values on an even count) across submissions within max_staleness
seconds of current ledger time.
10^decimals, to make clear submissions must use the currently
configured decimals scale or downstream payouts will be off by that
scale factor.
No behavior change - doc comment only.
Verification
Closes #219.