Remove granularity from genesis (#8514)
This commit is contained in:
parent
113db8d656
commit
4831c7b9af
|
@ -206,13 +206,10 @@ fn add_stakes(
|
||||||
genesis_config: &mut GenesisConfig,
|
genesis_config: &mut GenesisConfig,
|
||||||
staker_infos: &[StakerInfo],
|
staker_infos: &[StakerInfo],
|
||||||
unlock_info: &UnlockInfo,
|
unlock_info: &UnlockInfo,
|
||||||
granularity: u64,
|
|
||||||
) -> u64 {
|
) -> u64 {
|
||||||
staker_infos
|
staker_infos
|
||||||
.iter()
|
.iter()
|
||||||
.map(|staker_info| {
|
.map(|staker_info| create_and_add_stakes(genesis_config, staker_info, unlock_info, None))
|
||||||
create_and_add_stakes(genesis_config, staker_info, unlock_info, granularity)
|
|
||||||
})
|
|
||||||
.sum::<u64>()
|
.sum::<u64>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,23 +221,16 @@ pub fn add_genesis_accounts(genesis_config: &mut GenesisConfig, mut issued_lampo
|
||||||
genesis_config,
|
genesis_config,
|
||||||
&BATCH_FOUR_STAKER_INFOS,
|
&BATCH_FOUR_STAKER_INFOS,
|
||||||
&UNLOCKS_ALL_AT_9_MONTHS,
|
&UNLOCKS_ALL_AT_9_MONTHS,
|
||||||
1_000_000 * LAMPORTS_PER_SOL,
|
|
||||||
) + add_stakes(
|
) + add_stakes(
|
||||||
genesis_config,
|
genesis_config,
|
||||||
&FOUNDATION_STAKER_INFOS,
|
&FOUNDATION_STAKER_INFOS,
|
||||||
&UNLOCKS_ALL_DAY_ZERO,
|
&UNLOCKS_ALL_DAY_ZERO,
|
||||||
1_000_000 * LAMPORTS_PER_SOL,
|
) + add_stakes(genesis_config, &GRANTS_STAKER_INFOS, &UNLOCKS_ALL_DAY_ZERO)
|
||||||
) + add_stakes(
|
+ add_stakes(
|
||||||
genesis_config,
|
genesis_config,
|
||||||
&GRANTS_STAKER_INFOS,
|
&COMMUNITY_STAKER_INFOS,
|
||||||
&UNLOCKS_ALL_DAY_ZERO,
|
&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,
|
|
||||||
);
|
|
||||||
|
|
||||||
// "one thanks" (community pool) gets 500_000_000SOL (total) - above distributions
|
// "one thanks" (community pool) gets 500_000_000SOL (total) - above distributions
|
||||||
create_and_add_stakes(
|
create_and_add_stakes(
|
||||||
|
@ -252,7 +242,7 @@ pub fn add_genesis_accounts(genesis_config: &mut GenesisConfig, mut issued_lampo
|
||||||
withdrawer: Some("3FFaheyqtyAXZSYxDzsr5CVKvJuvZD1WE1VEsBtDbRqB"),
|
withdrawer: Some("3FFaheyqtyAXZSYxDzsr5CVKvJuvZD1WE1VEsBtDbRqB"),
|
||||||
},
|
},
|
||||||
&UNLOCKS_ALL_DAY_ZERO,
|
&UNLOCKS_ALL_DAY_ZERO,
|
||||||
1_000_000 * LAMPORTS_PER_SOL,
|
None,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,9 @@ pub fn create_and_add_stakes(
|
||||||
// description of how the stakes' lockups will expire
|
// description of how the stakes' lockups will expire
|
||||||
unlock_info: &UnlockInfo,
|
unlock_info: &UnlockInfo,
|
||||||
// the largest each stake account should be, in lamports
|
// the largest each stake account should be, in lamports
|
||||||
granularity: u64,
|
granularity: Option<u64>,
|
||||||
) -> u64 {
|
) -> u64 {
|
||||||
|
let granularity = granularity.unwrap_or(std::u64::MAX);
|
||||||
let staker = &staker_info
|
let staker = &staker_info
|
||||||
.staker
|
.staker
|
||||||
.parse::<Pubkey>()
|
.parse::<Pubkey>()
|
||||||
|
@ -171,7 +172,7 @@ mod tests {
|
||||||
) {
|
) {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
total_lamports,
|
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!(genesis_config.accounts.len(), len);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
Loading…
Reference in New Issue