@@ -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"
|
||||
----
|
||||
|
||||
29
testing/dshackle/dshackle-real.yaml
Normal file
29
testing/dshackle/dshackle-real.yaml
Normal 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
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user