Pass sort in direct reader (#588)
This commit is contained in:
@@ -94,7 +94,7 @@ class EthereumDirectReaderSpec extends Specification {
|
||||
}
|
||||
}
|
||||
when:
|
||||
def act = reader.blockReader.read(new EthereumDirectReader.Request<BlockHash>(BlockHash.from(hash1), Selector.empty))
|
||||
def act = reader.blockReader.read(new EthereumDirectReader.Request<BlockHash>(BlockHash.from(hash1), Selector.UpstreamFilter.default))
|
||||
then:
|
||||
StepVerifier.create(act)
|
||||
.expectNextMatches { block ->
|
||||
@@ -122,7 +122,7 @@ class EthereumDirectReaderSpec extends Specification {
|
||||
}
|
||||
}
|
||||
when:
|
||||
def act = reader.blockReader.read(new EthereumDirectReader.Request<BlockHash>(BlockHash.from(hash1), Selector.empty))
|
||||
def act = reader.blockReader.read(new EthereumDirectReader.Request<BlockHash>(BlockHash.from(hash1), Selector.UpstreamFilter.default))
|
||||
then:
|
||||
StepVerifier.create(act)
|
||||
.expectComplete()
|
||||
@@ -155,7 +155,7 @@ class EthereumDirectReaderSpec extends Specification {
|
||||
}
|
||||
}
|
||||
when:
|
||||
def act = reader.blockByHeightReader.read(new EthereumDirectReader.Request<Long>(100L, Selector.empty))
|
||||
def act = reader.blockByHeightReader.read(new EthereumDirectReader.Request<Long>(100L, Selector.UpstreamFilter.default))
|
||||
then:
|
||||
StepVerifier.create(act)
|
||||
.expectNextMatches { block ->
|
||||
@@ -220,7 +220,7 @@ class EthereumDirectReaderSpec extends Specification {
|
||||
}
|
||||
}
|
||||
when:
|
||||
def act = reader.txReader.read(new EthereumDirectReader.Request<TransactionId>(TransactionId.from(hash1), Selector.empty))
|
||||
def act = reader.txReader.read(new EthereumDirectReader.Request<TransactionId>(TransactionId.from(hash1), Selector.UpstreamFilter.default))
|
||||
then:
|
||||
StepVerifier.create(act)
|
||||
.expectNextMatches { block ->
|
||||
@@ -253,7 +253,7 @@ class EthereumDirectReaderSpec extends Specification {
|
||||
}
|
||||
}
|
||||
when:
|
||||
def act = reader.receiptReader.read(new EthereumDirectReader.Request<TransactionId>(TransactionId.from(hash1), Selector.empty))
|
||||
def act = reader.receiptReader.read(new EthereumDirectReader.Request<TransactionId>(TransactionId.from(hash1), Selector.UpstreamFilter.default))
|
||||
.block(Duration.ofSeconds(1))
|
||||
.with { new String(it.data) }
|
||||
then:
|
||||
@@ -287,7 +287,7 @@ class EthereumDirectReaderSpec extends Specification {
|
||||
}
|
||||
}
|
||||
when:
|
||||
def act = reader.receiptReader.read(new EthereumDirectReader.Request<TransactionId>(TransactionId.from(hash1), Selector.empty))
|
||||
def act = reader.receiptReader.read(new EthereumDirectReader.Request<TransactionId>(TransactionId.from(hash1), Selector.UpstreamFilter.default))
|
||||
.block(Duration.ofSeconds(1))
|
||||
.with { new String(it.data) }
|
||||
then:
|
||||
@@ -312,7 +312,7 @@ class EthereumDirectReaderSpec extends Specification {
|
||||
}
|
||||
}
|
||||
when:
|
||||
def act = reader.txReader.read(new EthereumDirectReader.Request<TransactionId>(TransactionId.from(hash1), Selector.empty))
|
||||
def act = reader.txReader.read(new EthereumDirectReader.Request<TransactionId>(TransactionId.from(hash1), Selector.UpstreamFilter.default))
|
||||
then:
|
||||
StepVerifier.create(act)
|
||||
.expectComplete()
|
||||
@@ -411,7 +411,7 @@ class EthereumDirectReaderSpec extends Specification {
|
||||
}
|
||||
}
|
||||
when:
|
||||
def act = ethereumDirectReader.blockReader.read(new EthereumDirectReader.Request<BlockHash>(BlockHash.from(hash1), Selector.empty))
|
||||
def act = ethereumDirectReader.blockReader.read(new EthereumDirectReader.Request<BlockHash>(BlockHash.from(hash1), Selector.UpstreamFilter.default))
|
||||
then:
|
||||
StepVerifier.create(act)
|
||||
.expectNextMatches { block ->
|
||||
@@ -451,7 +451,7 @@ class EthereumDirectReaderSpec extends Specification {
|
||||
}
|
||||
}
|
||||
when:
|
||||
def act = ethereumDirectReader.blockByHeightReader.read(new EthereumDirectReader.Request<Long>(100L, Selector.empty))
|
||||
def act = ethereumDirectReader.blockByHeightReader.read(new EthereumDirectReader.Request<Long>(100L, Selector.UpstreamFilter.default))
|
||||
then:
|
||||
StepVerifier.create(act)
|
||||
.expectNextMatches { block ->
|
||||
|
||||
@@ -70,9 +70,9 @@ class EthereumLocalReaderSpec extends Specification {
|
||||
1 * getCurrentHeight() >> 101L
|
||||
}
|
||||
def reader = Mock(EthereumCachingReader) {
|
||||
_ * blocksByIdAsCont(Selector.empty) >> new EmptyReader<>()
|
||||
_ * txByHashAsCont(Selector.empty) >> new EmptyReader<>()
|
||||
1 * blocksByHeightAsCont(Selector.empty) >> Mock(Reader) {
|
||||
_ * blocksByIdAsCont(Selector.UpstreamFilter.default) >> new EmptyReader<>()
|
||||
_ * txByHashAsCont(Selector.UpstreamFilter.default) >> new EmptyReader<>()
|
||||
1 * blocksByHeightAsCont(Selector.UpstreamFilter.default) >> Mock(Reader) {
|
||||
1 * read(101L) >> Mono.just(
|
||||
new EthereumDirectReader.Result<>(TestingCommons.blockForEthereum(101L), List.of())
|
||||
)
|
||||
@@ -82,7 +82,7 @@ class EthereumLocalReaderSpec extends Specification {
|
||||
def router = new EthereumLocalReader(reader, methods, head, null)
|
||||
|
||||
when:
|
||||
def act = router.getBlockByNumber(["latest", false], Selector.empty)
|
||||
def act = router.getBlockByNumber(["latest", false], Selector.UpstreamFilter.default)
|
||||
|
||||
then:
|
||||
act != null
|
||||
@@ -98,9 +98,9 @@ class EthereumLocalReaderSpec extends Specification {
|
||||
setup:
|
||||
def head = Stub(Head) {}
|
||||
def reader = Mock(EthereumCachingReader) {
|
||||
_ * blocksByIdAsCont(Selector.empty) >> new EmptyReader<>()
|
||||
_ * txByHashAsCont(Selector.empty) >> new EmptyReader<>()
|
||||
1 * blocksByHeightAsCont(Selector.empty) >> Mock(Reader) {
|
||||
_ * blocksByIdAsCont(Selector.UpstreamFilter.default) >> new EmptyReader<>()
|
||||
_ * txByHashAsCont(Selector.UpstreamFilter.default) >> new EmptyReader<>()
|
||||
1 * blocksByHeightAsCont(Selector.UpstreamFilter.default) >> Mock(Reader) {
|
||||
1 * read(0L) >> Mono.just(
|
||||
new EthereumDirectReader.Result<>(TestingCommons.blockForEthereum(0L), List.of())
|
||||
)
|
||||
@@ -110,7 +110,7 @@ class EthereumLocalReaderSpec extends Specification {
|
||||
def router = new EthereumLocalReader(reader, methods, head, null)
|
||||
|
||||
when:
|
||||
def act = router.getBlockByNumber(["earliest", false], Selector.empty)
|
||||
def act = router.getBlockByNumber(["earliest", false], Selector.UpstreamFilter.default)
|
||||
|
||||
then:
|
||||
act != null
|
||||
@@ -126,9 +126,9 @@ class EthereumLocalReaderSpec extends Specification {
|
||||
setup:
|
||||
def head = Stub(Head) {}
|
||||
def reader = Mock(EthereumCachingReader) {
|
||||
_ * blocksByIdAsCont(Selector.empty) >> new EmptyReader<>()
|
||||
_ * txByHashAsCont(Selector.empty) >> new EmptyReader<>()
|
||||
1 * blocksByHeightAsCont(Selector.empty) >> Mock(Reader) {
|
||||
_ * blocksByIdAsCont(Selector.UpstreamFilter.default) >> new EmptyReader<>()
|
||||
_ * txByHashAsCont(Selector.UpstreamFilter.default) >> new EmptyReader<>()
|
||||
1 * blocksByHeightAsCont(Selector.UpstreamFilter.default) >> Mock(Reader) {
|
||||
1 * read(74735L) >> Mono.just(
|
||||
new EthereumDirectReader.Result<>(TestingCommons.blockForEthereum(74735L), List.of())
|
||||
)
|
||||
@@ -138,7 +138,7 @@ class EthereumLocalReaderSpec extends Specification {
|
||||
def router = new EthereumLocalReader(reader, methods, head, null)
|
||||
|
||||
when:
|
||||
def act = router.getBlockByNumber(["0x123ef", false], Selector.empty)
|
||||
def act = router.getBlockByNumber(["0x123ef", false], Selector.UpstreamFilter.default)
|
||||
|
||||
then:
|
||||
act != null
|
||||
@@ -184,15 +184,15 @@ class EthereumLocalReaderSpec extends Specification {
|
||||
setup:
|
||||
def head = Mock(Head)
|
||||
def reader = Mock(EthereumCachingReader) {
|
||||
_ * blocksByIdAsCont(Selector.empty) >> new EmptyReader<>()
|
||||
_ * txByHashAsCont(Selector.empty) >> new EmptyReader<>()
|
||||
_ * blocksByHeightAsCont(Selector.empty) >> new EmptyReader<>()
|
||||
_ * blocksByIdAsCont(Selector.UpstreamFilter.default) >> new EmptyReader<>()
|
||||
_ * txByHashAsCont(Selector.UpstreamFilter.default) >> new EmptyReader<>()
|
||||
_ * blocksByHeightAsCont(Selector.UpstreamFilter.default) >> new EmptyReader<>()
|
||||
}
|
||||
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET, false)
|
||||
def router = new EthereumLocalReader(reader, methods, head, null)
|
||||
|
||||
when:
|
||||
def act = router.getBlockByNumber(["0x0", true], Selector.empty)
|
||||
def act = router.getBlockByNumber(["0x0", true], Selector.UpstreamFilter.default)
|
||||
|
||||
then:
|
||||
act == null
|
||||
|
||||
@@ -133,7 +133,7 @@ class GenericWsHeadSpec extends Specification {
|
||||
new WsSubscriptions.SubscribeData(Flux.error(new RuntimeException()), "id", new AtomicReference<String>("")),
|
||||
new WsSubscriptions.SubscribeData(Flux.fromIterable([secondHeadBlock]), "id", new AtomicReference<String>(""))
|
||||
]
|
||||
1 * it.unsubscribe(new ChainRequest("eth_unsubscribe", new ListParams(""), 2, null, null, false, Selector.empty)) >>
|
||||
1 * it.unsubscribe(new ChainRequest("eth_unsubscribe", new ListParams(""), 2, null, null, false, Selector.UpstreamFilter.default)) >>
|
||||
Mono.just(new ChainResponse("".bytes, null))
|
||||
}
|
||||
|
||||
@@ -453,7 +453,7 @@ class GenericWsHeadSpec extends Specification {
|
||||
1 * it.subscribe(_) >> new WsSubscriptions.SubscribeData(
|
||||
Flux.error(new RuntimeException()), "id", new AtomicReference<String>(subId)
|
||||
)
|
||||
1 * it.unsubscribe(new ChainRequest("eth_unsubscribe", new ListParams(subId), 2, null, null, false, Selector.empty)) >>
|
||||
1 * it.unsubscribe(new ChainRequest("eth_unsubscribe", new ListParams(subId), 2, null, null, false, Selector.UpstreamFilter.default)) >>
|
||||
Mono.just(new ChainResponse("".bytes, null))
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class WsConnectionImplSpec extends Specification {
|
||||
|
||||
when:
|
||||
Flux.from(ws.handle(wsApiMock.inbound, wsApiMock.outbound)).subscribe()
|
||||
def act = ws.callRpc(new ChainRequest("eth_getTransactionByHash", new ListParams(["0x3ec2ebf5d0ec474d0ac6bc50d2770d8409ad76e119968e7919f85d5ec8915200"]), 15, null, null, false, Selector.empty))
|
||||
def act = ws.callRpc(new ChainRequest("eth_getTransactionByHash", new ListParams(["0x3ec2ebf5d0ec474d0ac6bc50d2770d8409ad76e119968e7919f85d5ec8915200"]), 15, null, null, false, Selector.UpstreamFilter.default))
|
||||
|
||||
then:
|
||||
StepVerifier.create(act)
|
||||
@@ -92,7 +92,7 @@ class WsConnectionImplSpec extends Specification {
|
||||
|
||||
when:
|
||||
Flux.from(ws.handle(wsApiMock.inbound, wsApiMock.outbound)).subscribe()
|
||||
def act = ws.callRpc(new ChainRequest("eth_getTransactionByHash", new ListParams(["0x3ec2ebf5d0ec474d0ac6bc50d2770d8409ad76e119968e7919f85d5ec8915200"]), 15, null, null, false, Selector.empty))
|
||||
def act = ws.callRpc(new ChainRequest("eth_getTransactionByHash", new ListParams(["0x3ec2ebf5d0ec474d0ac6bc50d2770d8409ad76e119968e7919f85d5ec8915200"]), 15, null, null, false, Selector.UpstreamFilter.default))
|
||||
|
||||
then:
|
||||
StepVerifier.create(act)
|
||||
@@ -126,7 +126,7 @@ class WsConnectionImplSpec extends Specification {
|
||||
|
||||
when:
|
||||
Flux.from(ws.handle(wsApiMock.inbound, wsApiMock.outbound)).subscribe()
|
||||
def act = ws.callRpc(new ChainRequest("eth_getTransactionByHash", new ListParams(["0x3ec2ebf5d0ec474d0ac6bc50d2770d8409ad76e119968e7919f85d5ec8915200"]), 15, null, null, false, Selector.empty))
|
||||
def act = ws.callRpc(new ChainRequest("eth_getTransactionByHash", new ListParams(["0x3ec2ebf5d0ec474d0ac6bc50d2770d8409ad76e119968e7919f85d5ec8915200"]), 15, null, null, false, Selector.UpstreamFilter.default))
|
||||
|
||||
then:
|
||||
StepVerifier.create(act)
|
||||
|
||||
Reference in New Issue
Block a user