Logs lower bound + fix state detection with null (#503)
This commit is contained in:
@@ -3,7 +3,7 @@ package io.emeraldpay.dshackle.upstream
|
||||
import io.emeraldpay.dshackle.Chain
|
||||
import io.emeraldpay.dshackle.reader.ChainReader
|
||||
import io.emeraldpay.dshackle.upstream.ethereum.EthereumLowerBoundService
|
||||
import io.emeraldpay.dshackle.upstream.ethereum.MAX_OFFSET
|
||||
import io.emeraldpay.dshackle.upstream.ethereum.EthereumLowerBoundTxDetector.Companion.MAX_OFFSET
|
||||
import io.emeraldpay.dshackle.upstream.ethereum.ZERO_ADDRESS
|
||||
import io.emeraldpay.dshackle.upstream.lowerbound.LowerBoundData
|
||||
import io.emeraldpay.dshackle.upstream.lowerbound.LowerBoundService
|
||||
@@ -49,6 +49,9 @@ class RecursiveLowerBoundServiceTest {
|
||||
on {
|
||||
read(ChainRequest("eth_getBlockTransactionCountByNumber", ListParams(it.toHex())))
|
||||
} doReturn Mono.just(ChainResponse("\"0x12\"".toByteArray(), null))
|
||||
on {
|
||||
read(ChainRequest("eth_getLogs", ListParams(mapOf("fromBlock" to it.toHex(), "toBlock" to it.toHex()))))
|
||||
} doReturn Mono.just(ChainResponse("[\"0x12\"]".toByteArray(), null))
|
||||
} else {
|
||||
on {
|
||||
read(ChainRequest("eth_getBalance", ListParams(ZERO_ADDRESS, it.toHex())))
|
||||
@@ -60,6 +63,9 @@ class RecursiveLowerBoundServiceTest {
|
||||
on {
|
||||
read(ChainRequest("eth_getBlockTransactionCountByNumber", ListParams(block.toHex())))
|
||||
} doReturn Mono.error(RuntimeException("No tx data"))
|
||||
on {
|
||||
read(ChainRequest("eth_getLogs", ListParams(mapOf("fromBlock" to block.toHex(), "toBlock" to block.toHex()))))
|
||||
} doReturn Mono.error(RuntimeException("No logs data"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,6 +83,7 @@ class RecursiveLowerBoundServiceTest {
|
||||
.expectNextMatches { it.lowerBound == 17964844L && it.type == LowerBoundType.STATE }
|
||||
.expectNextMatches { it.lowerBound == 17964844L && it.type == LowerBoundType.BLOCK }
|
||||
.expectNextMatches { it.lowerBound == 17964844L && it.type == LowerBoundType.TX }
|
||||
.expectNextMatches { it.lowerBound == 17964844L && it.type == LowerBoundType.LOGS }
|
||||
.thenCancel()
|
||||
.verify(Duration.ofSeconds(3))
|
||||
|
||||
@@ -87,6 +94,7 @@ class RecursiveLowerBoundServiceTest {
|
||||
LowerBoundData(17964844L, LowerBoundType.STATE),
|
||||
LowerBoundData(17964844L, LowerBoundType.BLOCK),
|
||||
LowerBoundData(17964844L, LowerBoundType.TX),
|
||||
LowerBoundData(17964844L, LowerBoundType.LOGS),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user