Skip to content

Commit d6251f6

Browse files
author
Michał Mrożek
authored
[FIX] Fix UninstallFilter handling and make tests more reliable (#792)
1 parent df2916b commit d6251f6

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/main/scala/io/iohk/ethereum/jsonrpc/EthService.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -829,10 +829,8 @@ class EthService(
829829
implicit val timeout: Timeout = Timeout(filterConfig.filterManagerQueryTimeout)
830830

831831
filterManager
832-
.askFor(FM.UninstallFilter(req.filterId))
833-
.map { _: Any =>
834-
Right(UninstallFilterResponse(success = true))
835-
}
832+
.askFor[FM.UninstallFilterResponse.type](FM.UninstallFilter(req.filterId))
833+
.map(_ => Right(UninstallFilterResponse(success = true)))
836834
}
837835

838836
def getFilterChanges(req: GetFilterChangesRequest): ServiceResponse[GetFilterChangesResponse] = {

src/rpcTest/scala/io/iohk/ethereum/rpcTest/RpcApiTests.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ class RpcApiTests extends AnyFlatSpec with Matchers with Logger {
781781
setupContractResponse1.getError shouldEqual null
782782

783783
// Mine 2 Contract creation transactions
784-
val minedBlock = service.blockFlowable(false).blockingFirst()
784+
val _ = service.blockFlowable(false).take(2).blockingLast()
785785

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

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

1090-
txCount.asBigInt shouldEqual currentCount.asBigInt + 1
1090+
txCount.asBigInt shouldEqual currentCount.asBigInt
10911091
}
10921092

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

0 commit comments

Comments
 (0)