Remove/address some TODOs (#6923)

This commit is contained in:
Michael Vines
2019-11-13 09:43:15 -07:00
committed by GitHub
parent 9246bee12b
commit fcc2874591
15 changed files with 52 additions and 54 deletions

View File

@ -514,7 +514,6 @@ impl Bank {
}
// if I'm the first Bank in an epoch, count, claim, disburse rewards from Inflation
// TODO: on-chain wallclock?
// years_elapsed = slots_elapsed / slots/year
let year = (self.epoch_schedule.get_last_slot_in_epoch(epoch)) as f64 / self.slots_per_year;
@ -1584,7 +1583,6 @@ impl Bank {
let dbhq = dbank.blockhash_queue.read().unwrap();
assert_eq!(*bhq, *dbhq);
// TODO: Uncomment once status cache serialization is done
let sc = self.src.status_cache.read().unwrap();
let dsc = dbank.src.status_cache.read().unwrap();
assert_eq!(*sc, *dsc);

View File

@ -191,10 +191,12 @@ impl SyncClient for BankClient {
}
};
if now.elapsed().as_secs() > 15 {
// TODO: Return a better error.
return Err(TransportError::IoError(io::Error::new(
io::ErrorKind::Other,
"signature not found",
format!(
"signature not found after {} seconds",
now.elapsed().as_secs()
),
)));
}
sleep(Duration::from_millis(250));
@ -212,10 +214,12 @@ impl SyncClient for BankClient {
}
}
if now.elapsed().as_secs() > 15 {
// TODO: Return a better error.
return Err(TransportError::IoError(io::Error::new(
io::ErrorKind::Other,
"signature not found",
format!(
"signature not found after {} seconds",
now.elapsed().as_secs()
),
)));
}
sleep(Duration::from_millis(250));

View File

@ -29,12 +29,11 @@ pub fn create_genesis_config_with_leader(
bootstrap_leader_stake_lamports: u64,
) -> GenesisConfigInfo {
let mint_keypair = Keypair::new();
let voting_keypair = Keypair::new();
let staking_keypair = Keypair::new();
let bootstrap_leader_voting_keypair = Keypair::new();
let bootstrap_leader_staking_keypair = Keypair::new();
// TODO: de-duplicate the stake... passive staking is fully implemented
let vote_account = vote_state::create_account(
&voting_keypair.pubkey(),
let bootstrap_leader_vote_account = vote_state::create_account(
&bootstrap_leader_voting_keypair.pubkey(),
&bootstrap_leader_pubkey,
0,
bootstrap_leader_stake_lamports,
@ -42,30 +41,31 @@ pub fn create_genesis_config_with_leader(
let rent = Rent::free();
let stake_account = stake_state::create_account(
&staking_keypair.pubkey(),
&voting_keypair.pubkey(),
&vote_account,
let bootstrap_leader_stake_account = stake_state::create_account(
&bootstrap_leader_staking_keypair.pubkey(),
&bootstrap_leader_voting_keypair.pubkey(),
&bootstrap_leader_vote_account,
&rent,
bootstrap_leader_stake_lamports,
);
let accounts = vec![
// the mint
(
mint_keypair.pubkey(),
Account::new(mint_lamports, 0, &system_program::id()),
),
// node needs an account to issue votes and storage proofs from, this will require
// airdrops at some point to cover fees...
(
*bootstrap_leader_pubkey,
Account::new(BOOTSTRAP_LEADER_LAMPORTS, 0, &system_program::id()),
),
// where votes go to
(voting_keypair.pubkey(), vote_account),
// passive bootstrap leader stake, duplicates above temporarily
(staking_keypair.pubkey(), stake_account),
(
bootstrap_leader_voting_keypair.pubkey(),
bootstrap_leader_vote_account,
),
(
bootstrap_leader_staking_keypair.pubkey(),
bootstrap_leader_stake_account,
),
];
// Bare minimum program set
@ -75,8 +75,8 @@ pub fn create_genesis_config_with_leader(
solana_vote_program!(),
solana_stake_program!(),
];
let fee_calculator = FeeCalculator::new(0, 0); // most tests don't want fees
let fee_calculator = FeeCalculator::new(0, 0); // most tests can't handle transaction fees
let mut genesis_config = GenesisConfig {
accounts,
native_instruction_processors,
@ -91,6 +91,6 @@ pub fn create_genesis_config_with_leader(
GenesisConfigInfo {
genesis_config,
mint_keypair,
voting_keypair,
voting_keypair: bootstrap_leader_voting_keypair,
}
}

View File

@ -93,7 +93,6 @@ impl<T: Serialize + Clone> StatusCache<T> {
None
}
/// TODO: wallets should send the Transactions recent blockhash as well
pub fn get_signature_status_slow(
&self,
sig: &Signature,