Fix archive (#444)

This commit is contained in:
KirillPamPam
2024-03-27 19:51:23 +04:00
committed by GitHub
parent 8b609ee2d1
commit 5fedc28d24
5 changed files with 12 additions and 12 deletions

View File

@@ -5,7 +5,6 @@ import io.emeraldpay.dshackle.reader.Reader
import io.emeraldpay.dshackle.test.ApiReaderMock
import io.emeraldpay.dshackle.test.TestingCommons
import io.emeraldpay.dshackle.upstream.DefaultUpstream
import io.emeraldpay.dshackle.upstream.ethereum.subscribe.EthereumLabelsDetector
import io.emeraldpay.dshackle.upstream.ChainRequest
import io.emeraldpay.dshackle.upstream.ChainResponse
import io.emeraldpay.dshackle.upstream.rpcclient.ListParams
@@ -24,8 +23,8 @@ class EthereumLabelsDetectorSpec extends Specification {
new ApiReaderMock().tap {
answer("web3_clientVersion", [], response)
answer("eth_blockNumber", [], "0x10df3e5")
answer("eth_getBalance", ["0x756F45E3FA69347A9A973A725E3C98bC4db0b5a0", "0x10dccd5"], "")
answer("eth_getBalance", ["0x756F45E3FA69347A9A973A725E3C98bC4db0b5a0", "0x2710"], "")
answer("eth_getBalance", ["0x0000000000000000000000000000000000000000", "0x10dccd5"], "")
answer("eth_getBalance", ["0x0000000000000000000000000000000000000000", "0x2710"], "")
}
)
def detector = new EthereumLabelsDetector(up.getIngressReader(), Chain.ETHEREUM__MAINNET)
@@ -57,9 +56,9 @@ class EthereumLabelsDetectorSpec extends Specification {
Mono.just(new ChainResponse('no/v1.19.3+e8ac1da4/linux-x64/dotnet7.0.8'.getBytes(), null))
1 * read(new ChainRequest("eth_blockNumber", new ListParams())) >>
Mono.just(new ChainResponse("\"0x10df3e5\"".getBytes(), null))
1 * read(new ChainRequest("eth_getBalance", new ListParams(["0x756F45E3FA69347A9A973A725E3C98bC4db0b5a0", "0x10dccd5"]))) >>
1 * read(new ChainRequest("eth_getBalance", new ListParams(["0x0000000000000000000000000000000000000000", "0x10dccd5"]))) >>
Mono.error(new RuntimeException())
1 * read(new ChainRequest("eth_getBalance", new ListParams(["0x756F45E3FA69347A9A973A725E3C98bC4db0b5a0", "0x2710"]))) >>
1 * read(new ChainRequest("eth_getBalance", new ListParams(["0x0000000000000000000000000000000000000000", "0x2710"]))) >>
Mono.just(new ChainResponse("".getBytes(), null))
}
}

View File

@@ -3,6 +3,7 @@ package io.emeraldpay.dshackle.upstream
import io.emeraldpay.dshackle.Chain
import io.emeraldpay.dshackle.reader.ChainReader
import io.emeraldpay.dshackle.upstream.ethereum.EthereumLowerBoundBlockDetector
import io.emeraldpay.dshackle.upstream.ethereum.ZERO_ADDRESS
import io.emeraldpay.dshackle.upstream.polkadot.PolkadotLowerBoundBlockDetector
import io.emeraldpay.dshackle.upstream.rpcclient.ListParams
import org.junit.jupiter.api.Assertions.assertEquals
@@ -86,11 +87,11 @@ class RecursiveLowerBoundBlockDetectorTest {
blocks.forEach {
if (it == 17964844L) {
on {
read(ChainRequest("eth_getBalance", ListParams("0x756F45E3FA69347A9A973A725E3C98bC4db0b5a0", it.toHex())))
read(ChainRequest("eth_getBalance", ListParams(ZERO_ADDRESS, it.toHex())))
} doReturn Mono.just(ChainResponse(ByteArray(0), null))
} else {
on {
read(ChainRequest("eth_getBalance", ListParams("0x756F45E3FA69347A9A973A725E3C98bC4db0b5a0", it.toHex())))
read(ChainRequest("eth_getBalance", ListParams(ZERO_ADDRESS, it.toHex())))
} doReturn Mono.error(RuntimeException("missing trie node"))
}
}