problem: doesn't get head updates from all available heads

solution: ensure all heads are started on multihead start
rel: #67
This commit is contained in:
Igor Artamonov
2021-03-27 15:16:58 -04:00
parent a26cc96ba6
commit 3ae5203d98
5 changed files with 98 additions and 1 deletions

View File

@@ -28,6 +28,27 @@ class DispatchSpec extends Specification {
calls1.size() + calls2.size() == 100
}
def "multiple calls routed roughly equal to upstreams - for latest block"() {
when:
def calls1before = ProxyClient.forOriginal(18545).execute("eth_call", [[to: "0x0123456789abcdef0123456789abcdef00000002"]]).result as List
def calls2before = ProxyClient.forOriginal(18546).execute("eth_call", [[to: "0x0123456789abcdef0123456789abcdef00000002"]]).result as List
100.times {
client.execute("eth_call", [[to: "0x0123456789abcdef0123456789abcdef00000001", data: "0x00000000" + Integer.toString(it, 16)], "0x100001"])
}
def calls1after = ProxyClient.forOriginal(18545).execute("eth_call", [[to: "0x0123456789abcdef0123456789abcdef00000002"]]).result as List
def calls2after = ProxyClient.forOriginal(18546).execute("eth_call", [[to: "0x0123456789abcdef0123456789abcdef00000002"]]).result as List
def calls1 = onlyNew(calls1before, calls1after)
def calls2 = onlyNew(calls2before, calls2after)
then:
calls1.size() >= 48
calls2.size() >= 48
calls1.size() + calls2.size() == 100
}
private List onlyNew(List before, List after) {
return after.findAll { a ->
!before.any { b ->