Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

tx-pool: failing tests fixed #12481

Merged
merged 1 commit into from
Oct 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions client/transaction-pool/tests/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1058,8 +1058,8 @@ fn finalized_only_handled_correctly() {
{
let mut stream = futures::executor::block_on_stream(watcher);
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(header.clone().hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((header.clone().hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((header.hash(), 0))));
assert_eq!(stream.next(), None);
}
}
Expand Down Expand Up @@ -1087,8 +1087,8 @@ fn best_block_after_finalized_handled_correctly() {
{
let mut stream = futures::executor::block_on_stream(watcher);
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(header.clone().hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((header.clone().hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((header.hash(), 0))));
assert_eq!(stream.next(), None);
}
}
Expand Down Expand Up @@ -1155,18 +1155,18 @@ fn switching_fork_with_finalized_works() {
{
let mut stream = futures::executor::block_on_stream(from_alice_watcher);
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b1_header.hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Retracted(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b2_header.hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((b2_header.hash(), 0))));
assert_eq!(stream.next(), None);
}

{
let mut stream = futures::executor::block_on_stream(from_bob_watcher);
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b2_header.hash(), 1))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((b2_header.hash(), 1))));
assert_eq!(stream.next(), None);
}
}
Expand Down Expand Up @@ -1250,31 +1250,31 @@ fn switching_fork_multiple_times_works() {
let mut stream = futures::executor::block_on_stream(from_alice_watcher);
//phase-0
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b1_header.hash(), 0))));
//phase-1
assert_eq!(stream.next(), Some(TransactionStatus::Retracted(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b2_header.hash(), 0))));
//phase-2
assert_eq!(stream.next(), Some(TransactionStatus::Retracted(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b1_header.hash(), 0))));
//phase-3
assert_eq!(stream.next(), Some(TransactionStatus::Retracted(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b2_header.hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((b2_header.hash(), 0))));
assert_eq!(stream.next(), None);
}

{
let mut stream = futures::executor::block_on_stream(from_bob_watcher);
//phase-1
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b2_header.hash(), 1))));
//phase-2
assert_eq!(stream.next(), Some(TransactionStatus::Retracted(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
//phase-3
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b2_header.hash(), 1))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((b2_header.hash(), 1))));
assert_eq!(stream.next(), None);
}
}
Expand Down Expand Up @@ -1373,24 +1373,24 @@ fn two_blocks_delayed_finalization_works() {
{
let mut stream = futures::executor::block_on_stream(from_alice_watcher);
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b1_header.hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((b1_header.hash(), 0))));
assert_eq!(stream.next(), None);
}

{
let mut stream = futures::executor::block_on_stream(from_bob_watcher);
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(c1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(c1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((c1_header.hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((c1_header.hash(), 0))));
assert_eq!(stream.next(), None);
}

{
let mut stream = futures::executor::block_on_stream(from_charlie_watcher);
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(d1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(d1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((d1_header.hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((d1_header.hash(), 0))));
assert_eq!(stream.next(), None);
}
}
Expand Down Expand Up @@ -1472,9 +1472,9 @@ fn delayed_finalization_does_not_retract() {
let mut stream = futures::executor::block_on_stream(from_alice_watcher);
//phase-0
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b1_header.hash(), 0))));
//phase-2
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((b1_header.hash(), 0))));
assert_eq!(stream.next(), None);
}

Expand All @@ -1483,9 +1483,9 @@ fn delayed_finalization_does_not_retract() {
//phase-0
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
//phase-1
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(c1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((c1_header.hash(), 0))));
//phase-3
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(c1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((c1_header.hash(), 0))));
assert_eq!(stream.next(), None);
}
}
Expand Down Expand Up @@ -1559,16 +1559,16 @@ fn best_block_after_finalization_does_not_retract() {
{
let mut stream = futures::executor::block_on_stream(from_alice_watcher);
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b1_header.hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((b1_header.hash(), 0))));
assert_eq!(stream.next(), None);
}

{
let mut stream = futures::executor::block_on_stream(from_bob_watcher);
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(c1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(c1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((c1_header.hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((c1_header.hash(), 0))));
assert_eq!(stream.next(), None);
}
}