Skip to content

Commit

Permalink
Remove granularity from genesis (bp #8514) (#8518)
Browse files Browse the repository at this point in the history
automerge
  • Loading branch information
mergify[bot] authored Mar 2, 2020
1 parent 0d4131a commit dad62e1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
26 changes: 8 additions & 18 deletions genesis/src/genesis_accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,10 @@ fn add_stakes(
genesis_config: &mut GenesisConfig,
staker_infos: &[StakerInfo],
unlock_info: &UnlockInfo,
granularity: u64,
) -> u64 {
staker_infos
.iter()
.map(|staker_info| {
create_and_add_stakes(genesis_config, staker_info, unlock_info, granularity)
})
.map(|staker_info| create_and_add_stakes(genesis_config, staker_info, unlock_info, None))
.sum::<u64>()
}

Expand All @@ -196,23 +193,16 @@ pub fn add_genesis_accounts(genesis_config: &mut GenesisConfig, mut issued_lampo
genesis_config,
&BATCH_FOUR_STAKER_INFOS,
&UNLOCKS_ALL_AT_9_MONTHS,
1_000_000 * LAMPORTS_PER_SOL,
) + add_stakes(
genesis_config,
&FOUNDATION_STAKER_INFOS,
&UNLOCKS_ALL_DAY_ZERO,
1_000_000 * LAMPORTS_PER_SOL,
) + add_stakes(
genesis_config,
&GRANTS_STAKER_INFOS,
&UNLOCKS_ALL_DAY_ZERO,
1_000_000 * LAMPORTS_PER_SOL,
) + add_stakes(
genesis_config,
&COMMUNITY_STAKER_INFOS,
&UNLOCKS_ALL_DAY_ZERO,
1_000_000 * LAMPORTS_PER_SOL,
);
) + add_stakes(genesis_config, &GRANTS_STAKER_INFOS, &UNLOCKS_ALL_DAY_ZERO)
+ add_stakes(
genesis_config,
&COMMUNITY_STAKER_INFOS,
&UNLOCKS_ALL_DAY_ZERO,
);

// "one thanks" (community pool) gets 500_000_000SOL (total) - above distributions
create_and_add_stakes(
Expand All @@ -223,7 +213,7 @@ pub fn add_genesis_accounts(genesis_config: &mut GenesisConfig, mut issued_lampo
lamports: 500_000_000 * LAMPORTS_PER_SOL - issued_lamports,
},
&UNLOCKS_ALL_DAY_ZERO,
1_000_000 * LAMPORTS_PER_SOL,
None,
);
}

Expand Down
5 changes: 3 additions & 2 deletions genesis/src/stakes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ pub fn create_and_add_stakes(
// description of how the stakes' lockups will expire
unlock_info: &UnlockInfo,
// the largest each stake account should be, in lamports
granularity: u64,
granularity: Option<u64>,
) -> u64 {
let granularity = granularity.unwrap_or(std::u64::MAX);
let authorized = Authorized::auto(
&staker_info
.staker
Expand Down Expand Up @@ -163,7 +164,7 @@ mod tests {
) {
assert_eq!(
total_lamports,
create_and_add_stakes(genesis_config, staker_info, unlock_info, granularity)
create_and_add_stakes(genesis_config, staker_info, unlock_info, Some(granularity))
);
assert_eq!(genesis_config.accounts.len(), len);
assert_eq!(
Expand Down

0 comments on commit dad62e1

Please sign in to comment.