emeraldpay / emeraldpay/dshackle

Can't use custom container after adding BSC Chain to Dshackle

Open
#222 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
350
Forks
57
PR merge metrics
No merged PRs in 30d

Description

Hey !

Hope you're fine !

## Here is the situation
I forked 3 repositories of EmeraldPay to try to add **BSC Chain to Dshackle** and some other chains after.

Here are the 3 repositories with my last versions :
- [dshackle (emeraldpay)](https://github.com/emeraldpay/dshackle) forked to [dshackle (starton)](https://github.com/starton-io/dshackle)
- [emerald-java-client (emeraldpay)](https://github.com/emeraldpay/emerald-java-client) forked to [emerald-java-client (starton)](https://github.com/starton-io/emerald-java-client)
- [emerald-grpc (emeraldpay)](https://github.com/emeraldpay/emerald-grpc) forked to [emerald-grpc (starton)](https://github.com/starton-io/emerald-grpc)

## emerald-grpc
So, I firstly added the BSC Chain in the [emerald-grpc (starton)](https://github.com/starton-io/emerald-grpc) repository.

## emerald-java-client
Then, I updated the [emerald-java-client (starton)](https://github.com/starton-io/emerald-java-client) repository to add the BSC Chain too.

I also edited the `.gitmodules` file to fetch the newly forked [emerald-grpc (starton)](https://github.com/starton-io/emerald-grpc) repository :
```bash
[submodule "emerald-grpc"]
path = emerald-grpc
url = https://github.com/starton-io/emerald-grpc.git
branch = master
```
Because I renamed the repository, I modified the `build.gradle` file with :
```groovy
sourceSets {
main {
proto {
srcDir 'emerald-grpc/proto'
}
}
}
```

And I built the Emerald Java Client with :
```bash
gradle build
```

For this part, all is working, the [emerald-grpc (starton)](https://github.com/starton-io/emerald-grpc) repository is well fetched and the build is 100% done (with 100 warning oops).

## dshackle

Here is the sad part. As all seems good for the two previous repositories, I now try to fetch the [emerald-java-client (starton)](https://github.com/starton-io/emerald-java-client) repository from the [dshackle (starton)](https://github.com/starton-io/dshackle) one.
As I didn't create a package on the Maven repository, I decided to use the JitPack plugin to easily get it.
Here is the `build.gradle` snippet code that I added:
```groovy
repositories {
maven { url "https://jitpack.io" }
}

dependencies {
implementation 'com.github.starton-io:emerald-java-client:master'
}
```
-- SOURCE: https://stackoverflow.com/questions/18748436/is-it-possible-to-declare-git-repository-as-dependency-in-android-gradle

Here is my `dshackle.yaml` file :
```yaml
version: v1
port: 2449
tls:
enabled: false

proxy:
host: 0.0.0.0
port: 8545
routes:
- id: eth
blockchain: ethereum
- id: bsc
blockchain: bsc

cluster:
upstreams:
- id: infura-eth
chain: ethereum
connection:
ethereum:
rpc:
url: "https://mainnet.infura.io/v3/${INFURA_USER}"
ws:
url: "wss://mainnet.infura.io/ws/v3/${INFURA_USER}"
- id: infura-goerli
chain: goerli
connection:
ethereum:
rpc:
url: "https://goerli.infura.io/v3/${INFURA_USER}"
- id: bsc
chain: bsc
connection:
ethereum:
rpc:
url: "https://bsc-dataseed.binance.org"
```
(NOTE: My INFURA_USER env var is well exported)

Then, I want to build Dshackle with :
```bash
gradle assemble
```
(I can't use `gradle build` because it will test the Gradle project and some tests doesn't pass and thus, the build fails...)

The build success at 100%, I now try to build a Docker Image :
```bash
gradle jibDockerBuild
```

All is good and I finally try to use my newly created image :
```bash
docker run -p 2449:2449 -p 8545:8545 -v $(pwd):/etc/dshackle -e "INFURA_USER=$INFURA_USER" 2bbbd761e3c9
```

And from this point, I have the following error:
```bash
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
_ _ __ _ _ _ _
| | | | / /| | | | | | | |
___ _ __ ___ ___ _ __ __ _| | __| | / /_| |___| |__ __ _ ___| | _| | ___
/ _ \ '_ ` _ \ / _ \ '__/ _` | |/ _` | / / _` / __| '_ \ / _` |/ __| |/ / |/ _ \
| __/ | | | | | __/ | | (_| | | (_| |/ / (_| \__ \ | | | (_| | (__| <| | __/
\___|_| |_| |_|\___|_| \__,_|_|\__,_/_/ \__,_|___/_| |_|\__,_|\___|_|\_\_|\___|
Emerald Dshackle - Fault Tolerant Load Balancer for Blockchain API
https://github.com/emeraldpay/dshackle
v0.14.0-SNAPSHOT built from 22b7b8f142 on 2023-01-06T18:39:38 UTC

2023-06-01 18:40:31.814 | INFO | StarterKt | Starting StarterKt using Java 13.0.2 on 5d787eb70555 with PID 1 (/app/classes started by root in /)
2023-06-01 18:40:31.833 | INFO | StarterKt | No active profile set, falling back to default profiles: default
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.bouncycastle.jcajce.provider.drbg.DRBG (file:/app/libs/bcprov-jdk15on-1.61.jar) to constructor sun.security.provider.Sun()
WARNING: Please consider reporting this to the maintainers of org.bouncycastle.jcajce.provider.drbg.DRBG
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2023-06-01 18:40:38.717 | INFO | Config | Using config: /etc/dshackle/dshackle.yaml
2023-06-01 18:40:39.989 | INFO | MonitoringSetup | Run Prometheus metrics on 127.0.0.1:8081/metrics
2023-06-01 18:40:41.088 | INFO | rrentEgressLogWriter | Egress Log is disabled
2023-06-01 18:40:41.096 | INFO | GrpcServer | Starting gRPC Server...
2023-06-01 18:40:41.111 | INFO | GrpcServer | Listening Native gRPC on 127.0.0.1:2449
2023-06-01 18:40:41.489 | WARN | igApplicationContext | Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grpcServer': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: 'io.grpc.Deadline$Ticker io.grpc.Deadline.getSystemTicker()'
2023-06-01 18:40:41.492 | INFO | entMultistreamHolder | Closing upstream connections...
2023-06-01 18:40:42.258 | ERROR | lureAnalysisReporter |

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

io.grpc.internal.ServerImplBuilder.(ServerImplBuilder.java:88)

The following method did not exist:

'io.grpc.Deadline$Ticker io.grpc.Deadline.getSystemTicker()'

The method's class, io.grpc.Deadline, is available from the following locations:

jar:file:/app/libs/reactor-grpc-1.0.1.jar!/io/grpc/Deadline.class
jar:file:/app/libs/grpc-context-1.42.1.jar!/io/grpc/Deadline.class

The class hierarchy was loaded from the following locations:

io.grpc.Deadline: file:/app/libs/reactor-grpc-1.0.1.jar

Action:

Correct the classpath of your application so that it contains a single, compatible version of io.grpc.Deadline
```

Here is my configuration :
```bash
Java: java 11.0.17 2022-10-18 LTS (openjdk@11)
Gradle: 7.6
Kotlin: 1.7.10
Groovy: 3.0.13
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 17.0.5 (Homebrew 17.0.5+0)
OS: Mac OS X 13.1 aarch64 (M1)
```

**/!\ WARNING /!\ :** I had to fix the `protobuf` and `reactor` plugins because of my Mac M1, here is the code snippets available in the `build.gradle` file for both [emerald-java-client (starton)](https://github.com/starton-io/emerald-java-client) and [dshackle (starton)](https://github.com/starton-io/dshackle) repositories :
```groovy
// FOR EMERALD-JAVA-CLIENT

protobuf {
protoc {
// if $PROTOC_PATH is set then locally installed protoc is used otherwise it is downloaded remotely
path = System.getenv("PROTOC_PATH") ?: null
if (osdetector.os == "osx") {
artifact = "com.google.protobuf:protoc:${protocVersion}:osx-x86_64"
} else {
artifact = "com.google.protobuf:protoc:${protocVersion}"
}
}
plugins {
grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" }
reactor {
path = System.getenv("PROTOC_PATH") ?: null
if (osdetector.os == "osx") {
artifact = "com.salesforce.servicelibs:reactor-grpc:${reactiveGrpcVersion}:osx-x86_64"
} else {
artifact = "com.salesforce.servicelibs:reactor-grpc:${reactiveGrpcVersion}"
}
}
}
generateProtoTasks {
all()*.plugins {
grpc {}
reactor {}
}
}
}
```
and
```groovy
// FOR DSHACKLE

protobuf {
protoc {
// if $PROTOC_PATH is set then locally installed protoc is used otherwise it is downloaded remotely
path = System.getenv("PROTOC_PATH") ?: null
if (osdetector.os == "osx") {
artifact = "com.google.protobuf:protoc:3.9.0:osx-x86_64"
} else {
artifact = "com.google.protobuf:protoc:3.9.0"
}
}
plugins {
}
generateProtoTasks {
}
}
```
-- SOURCE: [this GitHub issue comment](https://github.com/protocolbuffers/protobuf/issues/8062#issuecomment-1017003289)

Do you know where could be the problem ?

Thanks :)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.