Skip to content

Commit dbbbc06

Browse files
committed
add comments
1 parent d7fa02d commit dbbbc06

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

program/rust/src/validator.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,13 @@ fn checked_load_price_account(price_account_info: &[u8]) -> Option<&PriceAccount
149149
))
150150
}
151151

152+
/// Computes the stake caps for each publisher based on the oracle program accounts provided
153+
/// - `account_datas` - the account datas of the oracle program accounts
154+
/// - `timestamp` - the timestamp to include in the message
155+
/// - `m` - m is the cap per symbol, it gets split among all publishers of the symbol
156+
/// - `z` - when a symbol has less than `z` publishers, each publisher gets a cap of `m/z` (instead of `m/number_of_publishers`). This is to prevent a single publisher from getting a large cap when there are few publishers.
157+
///
158+
/// The stake cap for a publisher is computed as the sum of `m/min(z, number_of_publishers)` for all the symbols the publisher is publishing.
152159
pub fn compute_publisher_stake_caps<'a>(
153160
account_datas: impl IntoIterator<Item = &'a [u8]>,
154161
timestamp: i64,

0 commit comments

Comments
 (0)