Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Fix UninstallFilter handling and make tests more reliable #792

Merged
5 commits merged into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
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
6 changes: 2 additions & 4 deletions src/main/scala/io/iohk/ethereum/jsonrpc/EthService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -829,10 +829,8 @@ class EthService(
implicit val timeout: Timeout = Timeout(filterConfig.filterManagerQueryTimeout)

filterManager
.askFor(FM.UninstallFilter(req.filterId))
.map { _: Any =>
Right(UninstallFilterResponse(success = true))
}
.askFor[FM.UninstallFilterResponse.type](FM.UninstallFilter(req.filterId))
.map(_ => Right(UninstallFilterResponse(success = true)))
}

def getFilterChanges(req: GetFilterChangesRequest): ServiceResponse[GetFilterChangesResponse] = {
Expand Down
8 changes: 4 additions & 4 deletions src/rpcTest/scala/io/iohk/ethereum/rpcTest/RpcApiTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ class RpcApiTests extends AnyFlatSpec with Matchers with Logger {
setupContractResponse1.getError shouldEqual null

// Mine 2 Contract creation transactions
val minedBlock = service.blockFlowable(false).blockingFirst()
val _ = service.blockFlowable(false).take(2).blockingLast()

// Get receipt for both contract creation transactions
val receiptResponse = service.ethGetTransactionReceipt(setupContractResponse.getTransactionHash).send()
Expand Down Expand Up @@ -948,13 +948,13 @@ class RpcApiTests extends AnyFlatSpec with Matchers with Logger {
// Uninstall block filter
val blockFilter = service.ethNewBlockFilter().send()
val blockFilterid = blockFilter.getFilterId
val minedBlock = service.blockFlowable(false).blockingFirst()
val minedBlock = service.blockFlowable(false).take(2).blockingLast()
val blockchanges = service.ethGetFilterChanges(blockFilterid).send()
val addedBlocks = blockchanges.getLogs.asScala.toList.map(log => log.asInstanceOf[Hash].get)
addedBlocks should contain(minedBlock.getBlock.getHash)
val uninstalTxFilterResponse3 = service.ethUninstallFilter(blockFilterid).send()
uninstalTxFilterResponse.isUninstalled shouldEqual true
val minedBlock1 = service.blockFlowable(false).blockingFirst()
val minedBlock1 = service.blockFlowable(false).take(2).blockingLast()
val blockchanges1 = service.ethGetFilterChanges(blockFilterid).send()
blockchanges1.getLogs.asScala.toList.size shouldEqual 0

Expand Down Expand Up @@ -1087,7 +1087,7 @@ class RpcApiTests extends AnyFlatSpec with Matchers with Logger {
val txCountResponseWithPendingBlock = service.ethGetTransactionCount(firstAccount.address, pendingBlock).send()
val txCount = txCountResponseWithPendingBlock.getTransactionCount

txCount.asBigInt shouldEqual currentCount.asBigInt + 1
txCount.asBigInt shouldEqual currentCount.asBigInt
}

it should "personal_ListAccounts and eth_ListAccounts " taggedAs (PrivNet) in new ScenarioSetup {
Expand Down