From 9ef43cda8688d847bebdf201fd97a16255d33770 Mon Sep 17 00:00:00 2001 From: Jon Cinque Date: Wed, 27 Apr 2022 15:37:45 +0200 Subject: [PATCH] Fixup RPC subscription test --- rpc/src/rpc_pubsub.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/rpc/src/rpc_pubsub.rs b/rpc/src/rpc_pubsub.rs index f12ae086f22b63..171409f55132bf 100644 --- a/rpc/src/rpc_pubsub.rs +++ b/rpc/src/rpc_pubsub.rs @@ -592,8 +592,8 @@ mod tests { bank_forks::BankForks, commitment::{BlockCommitmentCache, CommitmentSlots}, genesis_utils::{ - create_genesis_config, create_genesis_config_with_vote_accounts, GenesisConfigInfo, - ValidatorVoteKeypairs, + activate_all_features, create_genesis_config, + create_genesis_config_with_vote_accounts, GenesisConfigInfo, ValidatorVoteKeypairs, }, vote_transaction::VoteTransaction, }, @@ -604,6 +604,7 @@ mod tests { hash::Hash, message::Message, pubkey::Pubkey, + rent::Rent, signature::{Keypair, Signer}, stake::{ self, instruction as stake_instruction, @@ -825,10 +826,12 @@ mod tests { #[serial] fn test_account_subscribe() { let GenesisConfigInfo { - genesis_config, + mut genesis_config, mint_keypair: alice, .. } = create_genesis_config(10_000_000_000); + genesis_config.rent = Rent::default(); + activate_all_features(&mut genesis_config); let new_stake_authority = solana_sdk::pubkey::new_rand(); let stake_authority = Keypair::new(); @@ -875,10 +878,7 @@ mod tests { let balance = { let bank = bank_forks.read().unwrap().working_bank(); let rent = &bank.rent_collector().rent; - let rent_exempt_reserve = rent.minimum_balance(StakeState::size_of()); - let minimum_delegation = - solana_stake_program::get_minimum_delegation(&bank.feature_set); - rent_exempt_reserve + minimum_delegation + rent.minimum_balance(StakeState::size_of()) }; let tx = system_transaction::transfer(&alice, &from.pubkey(), balance, blockhash); @@ -928,7 +928,13 @@ mod tests { serde_json::from_str::(&response).unwrap(), ); - let tx = system_transaction::transfer(&alice, &stake_authority.pubkey(), 1, blockhash); + let balance = { + let bank = bank_forks.read().unwrap().working_bank(); + let rent = &bank.rent_collector().rent; + rent.minimum_balance(0) + }; + let tx = + system_transaction::transfer(&alice, &stake_authority.pubkey(), balance, blockhash); process_transaction_and_notify(&bank_forks, &tx, &rpc_subscriptions, 1).unwrap(); sleep(Duration::from_millis(200)); let ix = stake_instruction::authorize(