Skip to content

Commit

Permalink
tosplit: remove provisioners::new
Browse files Browse the repository at this point in the history
  • Loading branch information
herr-seppia committed Dec 1, 2023
1 parent 20786c8 commit bf55ec9
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion consensus/example/consensus_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub fn run_main_loop(
// Load provisioners keys from external consensus keys.
// The loaded keys should be the same as the ones from Genesis State.
let keys = load_provisioners_keys(provisioners_num);
let mut provisioners = Provisioners::new();
let mut provisioners = Provisioners::default();

for (_, (_, pk)) in keys.iter().enumerate() {
provisioners.add_member_with_value(pk.clone(), 1000 * DUSK * 10);
Expand Down
2 changes: 1 addition & 1 deletion consensus/example/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn generate_keys(n: u64) -> Vec<(SecretKey, PublicKey)> {
fn generate_provisioners_from_keys(
keys: Vec<(SecretKey, PublicKey)>,
) -> Provisioners {
let mut p = Provisioners::new();
let mut p = Provisioners::default();

for (pos, (_, pk)) in keys.into_iter().enumerate() {
p.add_member_with_value(pk, 1000 * (pos as u64) * DUSK);
Expand Down
2 changes: 1 addition & 1 deletion consensus/src/aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ mod tests {

// Create provisioners
// Also populate a vector of headers
let mut p = Provisioners::new();
let mut p = Provisioners::default();
let mut input = vec![];

for sk in sks {
Expand Down
6 changes: 0 additions & 6 deletions consensus/src/user/provisioners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ pub struct Provisioners {
}

impl Provisioners {
pub fn new() -> Self {
Self {
members: BTreeMap::new(),
}
}

/// Adds a provisioner with stake.
///
/// It appends the stake if the given provisioner already exists.
Expand Down
2 changes: 1 addition & 1 deletion consensus/tests/sortition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ fn generate_provisioners(n: usize) -> Provisioners {
.map(|data| SecretKey::from_slice(&data[..]).expect("valid secret key"))
.collect();

let mut p = Provisioners::new();
let mut p = Provisioners::default();
for (i, sk) in sks.iter().enumerate().skip(1) {
let stake_value = 1000 * (i) as u64 * DUSK;
let pubkey_bls = PublicKey::new(BlsPublicKey::from(sk));
Expand Down
2 changes: 1 addition & 1 deletion node/benches/accept.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub fn verify_block_cert(c: &mut Criterion) {
for input in INPUTS {
group.measurement_time(Duration::from_secs(input.measurement_time));
let mut keys = vec![];
let mut provisioners = Provisioners::new();
let mut provisioners = Provisioners::default();
let rng = &mut StdRng::seed_from_u64(0xbeef);
for _ in 0..input.provisioners {
let sk = BlsSecretKey::random(rng);
Expand Down
2 changes: 1 addition & 1 deletion rusk/src/lib/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl VMExecution for Rusk {
(pubkey_bls, stake)
})
});
let mut ret = Provisioners::new();
let mut ret = Provisioners::default();
for (pubkey_bls, stake) in provisioners {
ret.add_member_with_stake(pubkey_bls, stake);
}
Expand Down

0 comments on commit bf55ec9

Please sign in to comment.