add genesis stake placeholders (#6969)
* add investor stake placeholders fixups fixups review comments, fixups make more data-looky for easier management rent may be zero rework with more tables, derived keys fixups rebase-fix fixups fixups * genesis is now too big to boot in 10 seconds
This commit is contained in:
@@ -41,7 +41,7 @@ use solana_sdk::{
|
||||
slot_hashes::SlotHashes,
|
||||
system_transaction,
|
||||
sysvar::{self, Sysvar},
|
||||
timing::duration_as_ns,
|
||||
timing::years_as_slots,
|
||||
transaction::{Result, Transaction, TransactionError},
|
||||
};
|
||||
use std::{
|
||||
@@ -699,12 +699,11 @@ impl Bank {
|
||||
self.ticks_per_slot = genesis_config.ticks_per_slot;
|
||||
self.slots_per_segment = genesis_config.slots_per_segment;
|
||||
self.max_tick_height = (self.slot + 1) * self.ticks_per_slot;
|
||||
// ticks/year = seconds/year ...
|
||||
self.slots_per_year = SECONDS_PER_YEAR
|
||||
// * (ns/s)/(ns/tick) / ticks/slot = 1/s/1/tick = ticks/s
|
||||
*(1_000_000_000.0 / duration_as_ns(&genesis_config.poh_config.target_tick_duration) as f64)
|
||||
// / ticks/slot
|
||||
/ self.ticks_per_slot as f64;
|
||||
self.slots_per_year = years_as_slots(
|
||||
1.0,
|
||||
&genesis_config.poh_config.target_tick_duration,
|
||||
self.ticks_per_slot,
|
||||
);
|
||||
|
||||
self.epoch_schedule = genesis_config.epoch_schedule;
|
||||
|
||||
@@ -1813,23 +1812,24 @@ mod tests {
|
||||
let bank = Bank::new_from_parent(
|
||||
&root_bank,
|
||||
&Pubkey::default(),
|
||||
2 * (SECONDS_PER_YEAR
|
||||
// * (ns/s)/(ns/tick) / ticks/slot = 1/s/1/tick = ticks/s
|
||||
*(1_000_000_000.0 / duration_as_ns(&genesis_block.poh_config.target_tick_duration) as f64)
|
||||
// / ticks/slot
|
||||
/ genesis_block.ticks_per_slot as f64) as u64,
|
||||
years_as_slots(
|
||||
2.0,
|
||||
&genesis_block.poh_config.target_tick_duration,
|
||||
genesis_block.ticks_per_slot,
|
||||
) as u64,
|
||||
);
|
||||
|
||||
let root_bank_2 = Arc::new(Bank::new(&genesis_block));
|
||||
let bank_with_success_txs = Bank::new_from_parent(
|
||||
&root_bank_2,
|
||||
&Pubkey::default(),
|
||||
2 * (SECONDS_PER_YEAR
|
||||
// * (ns/s)/(ns/tick) / ticks/slot = 1/s/1/tick = ticks/s
|
||||
*(1_000_000_000.0 / duration_as_ns(&genesis_block.poh_config.target_tick_duration) as f64)
|
||||
// / ticks/slot
|
||||
/ genesis_block.ticks_per_slot as f64) as u64,
|
||||
years_as_slots(
|
||||
2.0,
|
||||
&genesis_block.poh_config.target_tick_duration,
|
||||
genesis_block.ticks_per_slot,
|
||||
) as u64,
|
||||
);
|
||||
|
||||
assert_eq!(bank.last_blockhash(), genesis_block.hash());
|
||||
|
||||
// Initialize credit-debit and credit only accounts
|
||||
@@ -2017,11 +2017,11 @@ mod tests {
|
||||
let mut bank = Bank::new_from_parent(
|
||||
root_bank,
|
||||
&Pubkey::default(),
|
||||
2 * (SECONDS_PER_YEAR
|
||||
// * (ns/s)/(ns/tick) / ticks/slot = 1/s/1/tick = ticks/s
|
||||
*(1_000_000_000.0 / duration_as_ns(&genesis_block.poh_config.target_tick_duration) as f64)
|
||||
// / ticks/slot
|
||||
/ genesis_block.ticks_per_slot as f64) as u64,
|
||||
years_as_slots(
|
||||
2.0,
|
||||
&genesis_block.poh_config.target_tick_duration,
|
||||
genesis_block.ticks_per_slot,
|
||||
) as u64,
|
||||
);
|
||||
bank.rent_collector.slots_per_year = 421_812.0;
|
||||
bank.add_instruction_processor(mock_program_id, mock_process_instruction);
|
||||
|
Reference in New Issue
Block a user