committed by
GitHub
parent
a71833c17b
commit
fb4d8e1f62
@ -2425,8 +2425,7 @@ mod tests {
|
||||
|
||||
fn test_crds_values(pubkey: Pubkey) -> Vec<CrdsValue> {
|
||||
let entrypoint = ContactInfo::new_localhost(&pubkey, timestamp());
|
||||
let entrypoint_crdsvalue =
|
||||
CrdsValue::new_unsigned(CrdsData::ContactInfo(entrypoint.clone()));
|
||||
let entrypoint_crdsvalue = CrdsValue::new_unsigned(CrdsData::ContactInfo(entrypoint));
|
||||
vec![entrypoint_crdsvalue]
|
||||
}
|
||||
|
||||
|
@ -957,7 +957,7 @@ mod tests {
|
||||
&exit,
|
||||
Arc::new(RwLock::new(bank_forks)),
|
||||
Arc::new(RwLock::new(BlockCommitmentCache::default_with_blockstore(
|
||||
blockstore.clone(),
|
||||
blockstore,
|
||||
))),
|
||||
));
|
||||
|
||||
@ -1072,7 +1072,7 @@ mod tests {
|
||||
&exit,
|
||||
Arc::new(RwLock::new(bank_forks)),
|
||||
Arc::new(RwLock::new(BlockCommitmentCache::default_with_blockstore(
|
||||
blockstore.clone(),
|
||||
blockstore,
|
||||
))),
|
||||
));
|
||||
|
||||
|
@ -551,9 +551,9 @@ mod tests {
|
||||
cache2.increase_confirmation_stake(2, 5);
|
||||
|
||||
let mut block_commitment = HashMap::new();
|
||||
block_commitment.entry(1).or_insert(cache0.clone()); // Slot 1, conf 2
|
||||
block_commitment.entry(2).or_insert(cache1.clone()); // Slot 2, conf 1
|
||||
block_commitment.entry(3).or_insert(cache2.clone()); // Slot 3, conf 0
|
||||
block_commitment.entry(1).or_insert_with(|| cache0.clone()); // Slot 1, conf 2
|
||||
block_commitment.entry(2).or_insert_with(|| cache1.clone()); // Slot 2, conf 1
|
||||
block_commitment.entry(3).or_insert_with(|| cache2.clone()); // Slot 3, conf 0
|
||||
let block_commitment_cache = BlockCommitmentCache::new(
|
||||
block_commitment,
|
||||
0,
|
||||
@ -568,9 +568,9 @@ mod tests {
|
||||
|
||||
// Build map with multiple slots at conf 1
|
||||
let mut block_commitment = HashMap::new();
|
||||
block_commitment.entry(1).or_insert(cache1.clone()); // Slot 1, conf 1
|
||||
block_commitment.entry(2).or_insert(cache1.clone()); // Slot 2, conf 1
|
||||
block_commitment.entry(3).or_insert(cache2.clone()); // Slot 3, conf 0
|
||||
block_commitment.entry(1).or_insert_with(|| cache1.clone()); // Slot 1, conf 1
|
||||
block_commitment.entry(2).or_insert_with(|| cache1.clone()); // Slot 2, conf 1
|
||||
block_commitment.entry(3).or_insert_with(|| cache2.clone()); // Slot 3, conf 0
|
||||
let block_commitment_cache = BlockCommitmentCache::new(
|
||||
block_commitment,
|
||||
0,
|
||||
@ -585,9 +585,9 @@ mod tests {
|
||||
|
||||
// Build map with slot gaps
|
||||
let mut block_commitment = HashMap::new();
|
||||
block_commitment.entry(1).or_insert(cache1.clone()); // Slot 1, conf 1
|
||||
block_commitment.entry(3).or_insert(cache1.clone()); // Slot 3, conf 1
|
||||
block_commitment.entry(5).or_insert(cache2.clone()); // Slot 5, conf 0
|
||||
block_commitment.entry(1).or_insert_with(|| cache1.clone()); // Slot 1, conf 1
|
||||
block_commitment.entry(3).or_insert(cache1); // Slot 3, conf 1
|
||||
block_commitment.entry(5).or_insert_with(|| cache2.clone()); // Slot 5, conf 0
|
||||
let block_commitment_cache = BlockCommitmentCache::new(
|
||||
block_commitment,
|
||||
0,
|
||||
@ -602,9 +602,9 @@ mod tests {
|
||||
|
||||
// Build map with no conf 1 slots, but one higher
|
||||
let mut block_commitment = HashMap::new();
|
||||
block_commitment.entry(1).or_insert(cache0.clone()); // Slot 1, conf 2
|
||||
block_commitment.entry(2).or_insert(cache2.clone()); // Slot 2, conf 0
|
||||
block_commitment.entry(3).or_insert(cache2.clone()); // Slot 3, conf 0
|
||||
block_commitment.entry(1).or_insert(cache0); // Slot 1, conf 2
|
||||
block_commitment.entry(2).or_insert_with(|| cache2.clone()); // Slot 2, conf 0
|
||||
block_commitment.entry(3).or_insert_with(|| cache2.clone()); // Slot 3, conf 0
|
||||
let block_commitment_cache = BlockCommitmentCache::new(
|
||||
block_commitment,
|
||||
0,
|
||||
@ -619,15 +619,15 @@ mod tests {
|
||||
|
||||
// Build map with no conf 1 or higher slots
|
||||
let mut block_commitment = HashMap::new();
|
||||
block_commitment.entry(1).or_insert(cache2.clone()); // Slot 1, conf 0
|
||||
block_commitment.entry(2).or_insert(cache2.clone()); // Slot 2, conf 0
|
||||
block_commitment.entry(3).or_insert(cache2.clone()); // Slot 3, conf 0
|
||||
block_commitment.entry(1).or_insert_with(|| cache2.clone()); // Slot 1, conf 0
|
||||
block_commitment.entry(2).or_insert_with(|| cache2.clone()); // Slot 2, conf 0
|
||||
block_commitment.entry(3).or_insert(cache2); // Slot 3, conf 0
|
||||
let block_commitment_cache = BlockCommitmentCache::new(
|
||||
block_commitment,
|
||||
0,
|
||||
total_stake,
|
||||
bank_slot_5.clone(),
|
||||
blockstore.clone(),
|
||||
bank_slot_5,
|
||||
blockstore,
|
||||
0,
|
||||
0,
|
||||
);
|
||||
|
@ -2618,7 +2618,7 @@ pub(crate) mod tests {
|
||||
|
||||
let exit = Arc::new(AtomicBool::new(false));
|
||||
let block_commitment_cache = Arc::new(RwLock::new(
|
||||
BlockCommitmentCache::default_with_blockstore(blockstore.clone()),
|
||||
BlockCommitmentCache::default_with_blockstore(blockstore),
|
||||
));
|
||||
let subscriptions = Arc::new(RpcSubscriptions::new(
|
||||
&exit,
|
||||
|
@ -2321,7 +2321,7 @@ pub mod tests {
|
||||
r#"{{"jsonrpc":"2.0","id":1,"method":"simulateTransaction","params":["{}"]}}"#,
|
||||
tx_serialized_encoded,
|
||||
);
|
||||
let res = io.handle_request_sync(&req, meta.clone());
|
||||
let res = io.handle_request_sync(&req, meta);
|
||||
let expected = json!({
|
||||
"jsonrpc": "2.0",
|
||||
"result": {
|
||||
@ -2361,7 +2361,7 @@ pub mod tests {
|
||||
);
|
||||
|
||||
// should panic because `bank` is not frozen
|
||||
let _ = io.handle_request_sync(&req, meta.clone());
|
||||
let _ = io.handle_request_sync(&req, meta);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -745,11 +745,11 @@ mod tests {
|
||||
);
|
||||
let exit = Arc::new(AtomicBool::new(false));
|
||||
let block_commitment_cache = Arc::new(RwLock::new(
|
||||
BlockCommitmentCache::new_for_tests_with_blockstore(blockstore.clone()),
|
||||
BlockCommitmentCache::new_for_tests_with_blockstore(blockstore),
|
||||
));
|
||||
|
||||
let subscriptions =
|
||||
RpcSubscriptions::new(&exit, bank_forks.clone(), block_commitment_cache.clone());
|
||||
RpcSubscriptions::new(&exit, bank_forks.clone(), block_commitment_cache);
|
||||
rpc.subscriptions = Arc::new(subscriptions);
|
||||
let session = create_session();
|
||||
let (subscriber, _id_receiver, receiver) = Subscriber::new_test("accountNotification");
|
||||
@ -895,8 +895,7 @@ mod tests {
|
||||
let (subscriber, _id_receiver, receiver) = Subscriber::new_test("voteNotification");
|
||||
|
||||
// Setup Subscriptions
|
||||
let subscriptions =
|
||||
RpcSubscriptions::new(&exit, bank_forks.clone(), block_commitment_cache.clone());
|
||||
let subscriptions = RpcSubscriptions::new(&exit, bank_forks, block_commitment_cache);
|
||||
rpc.subscriptions = Arc::new(subscriptions);
|
||||
rpc.vote_subscribe(session, subscriber);
|
||||
|
||||
@ -922,6 +921,8 @@ mod tests {
|
||||
});
|
||||
|
||||
// Process votes and check they were notified.
|
||||
// FIX-ME-BETTER-LATER - clone below is required for testcase to pass
|
||||
#[allow(clippy::redundant_clone)]
|
||||
ClusterInfoVoteListener::get_and_process_votes_for_tests(
|
||||
&votes_receiver,
|
||||
&vote_tracker,
|
||||
|
Reference in New Issue
Block a user