problem: full block returns transactions in different order

fix: #82
This commit is contained in:
Igor Artamonov
2021-03-27 18:49:24 -04:00
parent 3ae5203d98
commit 0bbcc728c1
7 changed files with 135 additions and 3 deletions

View File

@@ -3,5 +3,12 @@
.Run from project root directory:
[source,bash]
----
./gradlew run --args="--configPath=./testing/dshackle/dshackle.yaml"
./gradlew run --args="--configPath=./testing/dshackle/dshackle-mock.yaml"
----
or
[source,bash]
----
./gradlew run --args="--configPath=./testing/dshackle/dshackle-real.yaml"
----

View File

@@ -0,0 +1,29 @@
version: v1
port: 12448
tls:
enabled: false
cluster:
upstreams:
- id: eth-1
chain: ethereum
connection:
ethereum:
rpc:
url: "${DSHACKLE_TEST_ETH1_RPC}"
ws:
url: "${DSHACKLE_TEST_ETH1_WS}"
origin: "${DSHACKLE_TEST_ETH1_WSORIGIN}"
cache:
redis:
enabled: false
proxy:
port: 18081
tls:
enabled: false
routes:
- id: eth
blockchain: ethereum

View File

@@ -24,8 +24,20 @@ class ProxyClient {
this.objectMapper = new ObjectMapper()
}
static ProxyClient ethereumMock() {
return forPrefix(18080, "eth")
}
static ProxyClient ethereumReal() {
return forPrefix(18081, "eth")
}
static ProxyClient forPrefix(String prefix) {
return new ProxyClient("http://127.0.0.1:18080/$prefix")
return forPrefix(18080, prefix)
}
static ProxyClient forPrefix(int port, String prefix) {
return new ProxyClient("http://127.0.0.1:$port/$prefix")
}
static ProxyClient forOriginal(int port) {

View File

@@ -0,0 +1,38 @@
package io.emeraldpay.dshackle.testing.trial.proxy
import io.emeraldpay.dshackle.testing.trial.Debugger
import io.emeraldpay.dshackle.testing.trial.ProxyClient
import spock.lang.Specification
import spock.lang.Timeout
class GetBlockRealSpec extends Specification {
def client = ProxyClient.ethereumReal()
def setup() {
Debugger.enabled = false
}
def cleanup() {
Debugger.enabled = true
}
@Timeout(15)
def "Correct order for transactions on #height"() {
expect:
def results = [
(client.execute("eth_getBlockByNumber", ["0x" + Integer.toString(height, 16), false]).result["transactions"] as List<String>),
(client.execute("eth_getBlockByNumber", ["0x" + Integer.toString(height, 16), true]).result["transactions"] as List<Map<String, Object>>)
.collect { it.hash }
]
println(results[0])
println(results[1])
results[0] == results[1]
where:
height << (10_000_000..10_000_500)
}
}