Return upstreamId from direct reader (#257)
This commit is contained in:
@@ -69,7 +69,7 @@ class EthereumDirectReaderSpec extends Specification {
|
||||
then:
|
||||
StepVerifier.create(act)
|
||||
.expectNextMatches { block ->
|
||||
block.hash.toHexWithPrefix() == hash1
|
||||
block.data.hash.toHexWithPrefix() == hash1
|
||||
}
|
||||
.expectComplete()
|
||||
.verify(Duration.ofSeconds(1))
|
||||
@@ -138,7 +138,7 @@ class EthereumDirectReaderSpec extends Specification {
|
||||
then:
|
||||
StepVerifier.create(act)
|
||||
.expectNextMatches { block ->
|
||||
block.hash.toHexWithPrefix() == hash1
|
||||
block.data.hash.toHexWithPrefix() == hash1
|
||||
}
|
||||
.expectComplete()
|
||||
.verify(Duration.ofSeconds(1))
|
||||
@@ -174,7 +174,7 @@ class EthereumDirectReaderSpec extends Specification {
|
||||
then:
|
||||
StepVerifier.create(act)
|
||||
.expectNextMatches { block ->
|
||||
block.hash.toHexWithPrefix() == hash1
|
||||
block.data.hash.toHexWithPrefix() == hash1
|
||||
}
|
||||
.expectComplete()
|
||||
.verify(Duration.ofSeconds(1))
|
||||
@@ -208,7 +208,7 @@ class EthereumDirectReaderSpec extends Specification {
|
||||
when:
|
||||
def act = reader.receiptReader.read(TransactionId.from(hash1))
|
||||
.block(Duration.ofSeconds(1))
|
||||
.with { new String(it) }
|
||||
.with { new String(it.data) }
|
||||
then:
|
||||
act == '{"blockHash":"0x40d15edaff9acdabd2a1c96fd5f683b3300aad34e7015f34def3c56ba8a7ffb5","blockNumber":"0x64","transactionHash":"0x40d15edaff9acdabd2a1c96fd5f683b3300aad34e7015f34def3c56ba8a7ffb5","logs":[]}'
|
||||
}
|
||||
@@ -245,7 +245,7 @@ class EthereumDirectReaderSpec extends Specification {
|
||||
when:
|
||||
def act = reader.receiptReader.read(TransactionId.from(hash1))
|
||||
.block(Duration.ofSeconds(1))
|
||||
.with { new String(it) }
|
||||
.with { new String(it.data) }
|
||||
then:
|
||||
act == '{"blockHash":"0x40d15edaff9acdabd2a1c96fd5f683b3300aad34e7015f34def3c56ba8a7ffb5","blockNumber":"0x64","transactionHash":"0x40d15edaff9acdabd2a1c96fd5f683b3300aad34e7015f34def3c56ba8a7ffb5","logs":[]}'
|
||||
}
|
||||
@@ -302,7 +302,7 @@ class EthereumDirectReaderSpec extends Specification {
|
||||
}
|
||||
}
|
||||
when:
|
||||
def act = reader.balanceReader.read(Address.from(address1))
|
||||
def act = reader.balanceReader.read(Address.from(address1)).map {it.data}
|
||||
then:
|
||||
StepVerifier.create(act)
|
||||
.expectNext(Wei.from("0x100"))
|
||||
@@ -334,7 +334,7 @@ class EthereumDirectReaderSpec extends Specification {
|
||||
}
|
||||
}
|
||||
when:
|
||||
def act = reader.balanceReader.read(Address.from(address1))
|
||||
def act = reader.balanceReader.read(Address.from(address1)).map {it.data}
|
||||
then:
|
||||
StepVerifier.create(act)
|
||||
.expectNext(Wei.from("0x100"))
|
||||
@@ -379,7 +379,7 @@ class EthereumDirectReaderSpec extends Specification {
|
||||
then:
|
||||
StepVerifier.create(act)
|
||||
.expectNextMatches { block ->
|
||||
block.hash.toHexWithPrefix() == hash1
|
||||
block.data.hash.toHexWithPrefix() == hash1
|
||||
}
|
||||
.expectComplete()
|
||||
.verify(Duration.ofSeconds(1))
|
||||
@@ -422,7 +422,7 @@ class EthereumDirectReaderSpec extends Specification {
|
||||
then:
|
||||
StepVerifier.create(act)
|
||||
.expectNextMatches { block ->
|
||||
block.hash.toHexWithPrefix() == hash1
|
||||
block.data.hash.toHexWithPrefix() == hash1
|
||||
}
|
||||
.expectComplete()
|
||||
.verify(Duration.ofSeconds(1))
|
||||
|
||||
@@ -69,7 +69,9 @@ class EthereumLocalReaderSpec extends Specification {
|
||||
_ * blocksByIdAsCont() >> new EmptyReader<>()
|
||||
_ * txByHashAsCont() >> new EmptyReader<>()
|
||||
1 * blocksByHeightAsCont() >> Mock(Reader) {
|
||||
1 * read(101L) >> Mono.just(TestingCommons.blockForEthereum(101L))
|
||||
1 * read(101L) >> Mono.just(
|
||||
new EthereumDirectReader.Result<>(TestingCommons.blockForEthereum(101L), null)
|
||||
)
|
||||
}
|
||||
}
|
||||
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
|
||||
@@ -81,8 +83,8 @@ class EthereumLocalReaderSpec extends Specification {
|
||||
then:
|
||||
act != null
|
||||
with(act.block()) {
|
||||
it.length > 0
|
||||
with(Global.objectMapper.readValue(it, BlockJson)) {
|
||||
it.first.length > 0
|
||||
with(Global.objectMapper.readValue(it.first, BlockJson)) {
|
||||
number == 101
|
||||
}
|
||||
}
|
||||
@@ -95,7 +97,9 @@ class EthereumLocalReaderSpec extends Specification {
|
||||
_ * blocksByIdAsCont() >> new EmptyReader<>()
|
||||
_ * txByHashAsCont() >> new EmptyReader<>()
|
||||
1 * blocksByHeightAsCont() >> Mock(Reader) {
|
||||
1 * read(0L) >> Mono.just(TestingCommons.blockForEthereum(0L))
|
||||
1 * read(0L) >> Mono.just(
|
||||
new EthereumDirectReader.Result<>(TestingCommons.blockForEthereum(0L), null)
|
||||
)
|
||||
}
|
||||
}
|
||||
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
|
||||
@@ -107,8 +111,8 @@ class EthereumLocalReaderSpec extends Specification {
|
||||
then:
|
||||
act != null
|
||||
with(act.block()) {
|
||||
it.length > 0
|
||||
with(Global.objectMapper.readValue(it, BlockJson)) {
|
||||
it.first.length > 0
|
||||
with(Global.objectMapper.readValue(it.first, BlockJson)) {
|
||||
number == 0
|
||||
}
|
||||
}
|
||||
@@ -121,7 +125,9 @@ class EthereumLocalReaderSpec extends Specification {
|
||||
_ * blocksByIdAsCont() >> new EmptyReader<>()
|
||||
_ * txByHashAsCont() >> new EmptyReader<>()
|
||||
1 * blocksByHeightAsCont() >> Mock(Reader) {
|
||||
1 * read(74735L) >> Mono.just(TestingCommons.blockForEthereum(74735L))
|
||||
1 * read(74735L) >> Mono.just(
|
||||
new EthereumDirectReader.Result<>(TestingCommons.blockForEthereum(74735L), null)
|
||||
)
|
||||
}
|
||||
}
|
||||
def methods = new DefaultEthereumMethods(Chain.ETHEREUM__MAINNET)
|
||||
@@ -133,8 +139,8 @@ class EthereumLocalReaderSpec extends Specification {
|
||||
then:
|
||||
act != null
|
||||
with(act.block()) {
|
||||
it.length > 0
|
||||
with(Global.objectMapper.readValue(it, BlockJson)) {
|
||||
it.first.length > 0
|
||||
with(Global.objectMapper.readValue(it.first, BlockJson)) {
|
||||
number == 74735
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package io.emeraldpay.dshackle.upstream.ethereum.subscribe
|
||||
import io.emeraldpay.dshackle.data.BlockId
|
||||
import io.emeraldpay.dshackle.data.TxId
|
||||
import io.emeraldpay.dshackle.reader.Reader
|
||||
import io.emeraldpay.dshackle.upstream.ethereum.EthereumDirectReader
|
||||
import reactor.core.publisher.Mono
|
||||
import spock.lang.Specification
|
||||
|
||||
@@ -38,7 +39,8 @@ class ProduceLogsSpec extends Specification {
|
||||
' }'
|
||||
|
||||
def receipts = Mock(Reader) {
|
||||
1 * it.read(TxId.from("0x6c88df9d65ccc9351db65676c3581b29483e8dabb71c48ef7671c44b0d5568af")) >> Mono.just(receipt.getBytes())
|
||||
1 * it.read(TxId.from("0x6c88df9d65ccc9351db65676c3581b29483e8dabb71c48ef7671c44b0d5568af")) >>
|
||||
Mono.just(new EthereumDirectReader.Result<>(receipt.getBytes(), null))
|
||||
}
|
||||
def producer = new ProduceLogs(receipts)
|
||||
def update = new ConnectBlockUpdates.Update(
|
||||
@@ -61,7 +63,8 @@ class ProduceLogsSpec extends Specification {
|
||||
String receipt = 'null'
|
||||
|
||||
def receipts = Mock(Reader) {
|
||||
1 * it.read(TxId.from("0x6c88df9d65ccc9351db65676c3581b29483e8dabb71c48ef7671c44b0d5568af")) >> Mono.just(receipt.getBytes())
|
||||
1 * it.read(TxId.from("0x6c88df9d65ccc9351db65676c3581b29483e8dabb71c48ef7671c44b0d5568af")) >>
|
||||
Mono.just(new EthereumDirectReader.Result<>(receipt.getBytes(), null))
|
||||
}
|
||||
def producer = new ProduceLogs(receipts)
|
||||
def update = new ConnectBlockUpdates.Update(
|
||||
@@ -107,7 +110,8 @@ class ProduceLogsSpec extends Specification {
|
||||
' }'
|
||||
|
||||
def receipts = Mock(Reader) {
|
||||
1 * it.read(TxId.from("0x6c88df9d65ccc9351db65676c3581b29483e8dabb71c48ef7671c44b0d5568af")) >> Mono.just(receipt.getBytes())
|
||||
1 * it.read(TxId.from("0x6c88df9d65ccc9351db65676c3581b29483e8dabb71c48ef7671c44b0d5568af")) >>
|
||||
Mono.just(new EthereumDirectReader.Result<>(receipt.getBytes(), null))
|
||||
}
|
||||
def producer = new ProduceLogs(receipts)
|
||||
def update = new ConnectBlockUpdates.Update(
|
||||
@@ -153,7 +157,8 @@ class ProduceLogsSpec extends Specification {
|
||||
' }'
|
||||
|
||||
def receipts = Mock(Reader) {
|
||||
1 * it.read(TxId.from("0x6c88df9d65ccc9351db65676c3581b29483e8dabb71c48ef7671c44b0d5568af")) >> Mono.just(receipt.getBytes())
|
||||
1 * it.read(TxId.from("0x6c88df9d65ccc9351db65676c3581b29483e8dabb71c48ef7671c44b0d5568af")) >>
|
||||
Mono.just(new EthereumDirectReader.Result<>(receipt.getBytes(), null))
|
||||
}
|
||||
def producer = new ProduceLogs(receipts)
|
||||
def update = new ConnectBlockUpdates.Update(
|
||||
@@ -264,7 +269,8 @@ class ProduceLogsSpec extends Specification {
|
||||
' }'
|
||||
|
||||
def receipts = Mock(Reader) {
|
||||
1 * it.read(TxId.from("0xb5e554178a94fd993111f2ae64cb708cb0899d7b5182024e70d5c468164a8bec")) >> Mono.just(receipt.getBytes())
|
||||
1 * it.read(TxId.from("0xb5e554178a94fd993111f2ae64cb708cb0899d7b5182024e70d5c468164a8bec")) >>
|
||||
Mono.just(new EthereumDirectReader.Result<>(receipt.getBytes(), null))
|
||||
}
|
||||
def producer = new ProduceLogs(receipts)
|
||||
def update = new ConnectBlockUpdates.Update(
|
||||
@@ -343,7 +349,8 @@ class ProduceLogsSpec extends Specification {
|
||||
' }'
|
||||
|
||||
def receipts = Mock(Reader) {
|
||||
1 * it.read(TxId.from("0xb5e554178a94fd993111f2ae64cb708cb0899d7b5182024e70d5c468164a8bec")) >> Mono.just(receipt.getBytes())
|
||||
1 * it.read(TxId.from("0xb5e554178a94fd993111f2ae64cb708cb0899d7b5182024e70d5c468164a8bec")) >>
|
||||
Mono.just(new EthereumDirectReader.Result<>(receipt.getBytes(), null))
|
||||
}
|
||||
def producer = new ProduceLogs(receipts)
|
||||
def update1 = new ConnectBlockUpdates.Update(
|
||||
|
||||
Reference in New Issue
Block a user