Skip to content

Commit 8d05135

Browse files
committed
Renamed field of weighted_config
1 parent e07f9f5 commit 8d05135

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

crates/aptos-crypto/src/weighted_config.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub struct WeightedConfig<TC: ThresholdConfig> {
3232
/// The total number of players in the protocol.
3333
num_players: usize,
3434
/// Each player's weight
35-
weight: Vec<usize>,
35+
weights: Vec<usize>,
3636
/// Player's starting index `a` in a vector of all `W` shares, such that this player owns shares
3737
/// `W[a, a + weight[player])`. Useful during weighted secret reconstruction.
3838
starting_index: Vec<usize>,
@@ -86,7 +86,7 @@ impl<TC: ThresholdConfig> WeightedConfig<TC> {
8686
Ok(WeightedConfig {
8787
tc,
8888
num_players: n,
89-
weight: weights,
89+
weights,
9090
starting_index,
9191
max_weight,
9292
min_weight,
@@ -101,7 +101,7 @@ impl<TC: ThresholdConfig> WeightedConfig<TC> {
101101
/// Returns _a_ player who has the smallest weight.
102102
pub fn get_min_weight_player(&self) -> Player {
103103
if let Some((i, _weight)) = self
104-
.weight
104+
.weights
105105
.iter()
106106
.enumerate()
107107
.min_by_key(|&(_, &weight)| weight)
@@ -116,7 +116,7 @@ impl<TC: ThresholdConfig> WeightedConfig<TC> {
116116
/// Returns _a_ player who has the largest weight.
117117
pub fn get_max_weight_player(&self) -> Player {
118118
if let Some((i, _weight)) = self
119-
.weight
119+
.weights
120120
.iter()
121121
.enumerate()
122122
.max_by_key(|&(_, &weight)| weight)
@@ -150,7 +150,7 @@ impl<TC: ThresholdConfig> WeightedConfig<TC> {
150150

151151
/// Returns the weight of a specific player.
152152
pub fn get_player_weight(&self, player: &Player) -> usize {
153-
self.weight[player.id]
153+
self.weights[player.id]
154154
}
155155

156156
/// Returns the starting index of a player's shares in the flattened vector of all weighted shares.
@@ -165,7 +165,7 @@ impl<TC: ThresholdConfig> WeightedConfig<TC> {
165165
/// This function returns the "virtual" player associated with the $i$th sub-share of this player.
166166
pub fn get_virtual_player(&self, player: &Player, j: usize) -> Player {
167167
// println!("WeightedConfig::get_virtual_player({player}, {i})");
168-
assert_lt!(j, self.weight[player.id]);
168+
assert_lt!(j, self.weights[player.id]);
169169

170170
let id = self.get_share_index(player.id, j).unwrap();
171171

@@ -186,7 +186,7 @@ impl<TC: ThresholdConfig> WeightedConfig<TC> {
186186
///
187187
/// Returns the index of this player's share in the vector of shares, or None if out of bounds.
188188
pub fn get_share_index(&self, i: usize, j: usize) -> Option<usize> {
189-
if j < self.weight[i] {
189+
if j < self.weights[i] {
190190
Some(self.starting_index[i] + j)
191191
} else {
192192
None
@@ -235,7 +235,7 @@ impl<TC: ThresholdConfig> WeightedConfig<TC> {
235235
fn sort_players_by_weight(&self) -> Vec<(Player, usize)> {
236236
// the set of remaining players that we are picking a "capable" subset from
237237
let mut player_and_weights = self
238-
.weight
238+
.weights
239239
.iter()
240240
.enumerate()
241241
.map(|(i, w)| (self.get_player(i), *w))
@@ -305,7 +305,7 @@ impl<TC: ThresholdConfig> traits::SecretSharingConfig for WeightedConfig<TC> {
305305
let mut picked_players = vec![];
306306
// the set of remaining players that we are picking a "capable" subset from
307307
let mut player_and_weights = self
308-
.weight
308+
.weights
309309
.iter()
310310
.enumerate()
311311
.map(|(i, w)| (i, *w))

0 commit comments

Comments
 (0)