Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
761c480
P2P: added libp2p-minimal to build process, example code and run task.
jeromerousselot Mar 24, 2021
8f9dd63
gradle: added eclipse plugin and removed host dependent config files,…
jeromerousselot Mar 24, 2021
890fcc3
WIP: P2PMinimaDiscovery
jeromerousselot Mar 29, 2021
19f9068
p2p: imported and refactored teku Java classes to interface with libp…
jeromerousselot Mar 30, 2021
cfed9ea
ssz: added teku ssz fork within minima.
jeromerousselot Apr 8, 2021
1dd12cd
p2p: added teku peer classes to represent peer hosts.
jeromerousselot Apr 8, 2021
b871b60
p2p: added teku/besu metrics classes needed for p2p classes.
jeromerousselot Apr 8, 2021
f9c5798
p2p: higher level classes to enable libp2p peer discovery.
jeromerousselot Apr 8, 2021
d585772
p2p: added teku dependencies jar to enable libp2p peer hosts discovery.
jeromerousselot Apr 8, 2021
b738490
p2p: added most/all classes needed.
jeromerousselot Apr 9, 2021
52bb0df
p2p: added netty firewall rules and removed some duplicate rpc classes.
jeromerousselot Apr 9, 2021
fddeaa3
p2p: added ETH2 DiscoveryV5 protocol layer running on libp2p.
jeromerousselot Apr 13, 2021
4c4dc04
p2p: added 3rd node scenario.
jeromerousselot Apr 15, 2021
8b8c8d0
p2p: added log4j2, config file, and extended P2PStart.
jeromerousselot Apr 21, 2021
6522211
p2p: discovery network with traces and periodic peers logging.
jeromerousselot Apr 22, 2021
63e2a1f
p2p: added log messages to discovery classes, cleaned up P2PStart.
jeromerousselot Apr 22, 2021
b4ad607
p2p: build.gradle updated libp2p to 0.8.1 and discovery to 0.4.6
jeromerousselot Apr 22, 2021
ad2ae38
p2p: detects new peers every 5 seconds in P2PStart, and commented out…
jeromerousselot Apr 22, 2021
52259ba
p2p: implemented MessageProcessor in P2PStart and integrated within M…
jeromerousselot Apr 22, 2021
285b2c2
p2p: modified Start process to disable existing networking stack if p…
jeromerousselot May 9, 2021
fcf2f13
Merge remote-tracking branch 'origin/master' into tests-p2p
jeromerousselot May 9, 2021
59908a4
p2p: made node key persistent (-> persistent nodeID).
jeromerousselot May 10, 2021
fa66443
p2p: added new fields to REST API status for p2p.
jeromerousselot May 13, 2021
d62211a
e2e: upgraded node to v16.
jeromerousselot May 13, 2021
81c8f0e
endtoend: added support for p2p layer, and new test on child node.
jeromerousselot May 14, 2021
e0ad4d4
ConsensusPrint: fixed error that made status answer not JSON complian…
jeromerousselot May 14, 2021
d3a23b5
p2p: cleaned up code and added ENR and NodeID to support filtering wh…
jeromerousselot May 20, 2021
26dcd1a
e2e: disabled host autoremove to enable docker container inspection a…
jeromerousselot May 26, 2021
e62b9f6
p2p: removed unused imports.
jeromerousselot May 26, 2021
258742a
gradle: added gradle.properties file to configure log4j2 reliably.
jeromerousselot May 26, 2021
d6276e1
e2e: refactored code and re-enabled auto-remove containers at termina…
jeromerousselot May 27, 2021
a443b3a
p2p: added cpushares option and increased nbNodes to 10.
jeromerousselot May 27, 2021
7f9461e
implemented docker run with params
panda-stack Jun 3, 2021
68ed9f4
updated endtoend with minima API
panda-stack Jun 9, 2021
2b0e9c8
saved result to the text file
panda-stack Jun 10, 2021
4a9ce47
updated e2e test
panda-stack Jun 11, 2021
f7cf4d9
Docker: re-enabled gradlew cache line to avoid gradle dl each time.
jeromerousselot Jun 28, 2021
ce4b5f3
p2p: save and re-load neighbours list V1.
jeromerousselot Jun 28, 2021
663e926
p2p: always use the same port for P2P discovery (basePort + 5) and pe…
jeromerousselot Jun 29, 2021
fe2d600
p2p: cleaned up code and added host pub key to neighbours CSV list.
jeromerousselot Jun 30, 2021
97b137f
p2p: removed debug statements.
jeromerousselot Jun 30, 2021
280eb3d
added cluster topology to e2e test
panda-stack Jul 13, 2021
ac190c3
Merge branch 'tests-p2p' of https://github.com/minima-global/Minima i…
panda-stack Jul 13, 2021
c6b9c32
updated e2e test
panda-stack Jul 13, 2021
b2df4d0
updated e2e test
panda-stack Jul 14, 2021
3c334d3
updated endtoend test
panda-stack Jul 14, 2021
0e8e40c
Add a variable to specify if this is an incoming or outgoing connection
spartacusrex99 Jul 15, 2021
40758bf
Merge pull request #339 from minima-global/tests-p2p-spartacus
jeromerousselot Jul 15, 2021
e035d48
Dockerfile: added comments to document the Dockerfiles.
jeromerousselot Jul 15, 2021
deca23e
Merge branch 'tests-p2p' of github.com:minima-global/Minima into test…
jeromerousselot Jul 15, 2021
0d0c29d
e2e: re-enabled p2p mode by default.
jeromerousselot Jul 15, 2021
e09e4ec
p2p: refactored timer to use timerMessage and uses CONNECT Minima API…
jeromerousselot Jul 15, 2021
2645d63
generate chart for p2p test
panda-stack Jul 22, 2021
d88ac17
Merge branch 'tests-p2p' of https://github.com/minima-global/Minima i…
panda-stack Jul 23, 2021
73cdd11
added npm package to e2e
panda-stack Jul 23, 2021
20e9825
updated endtoend
panda-stack Jul 25, 2021
39c8ba2
updated generating graph
panda-stack Jul 25, 2021
4633f48
updated endtoend
panda-stack Jul 25, 2021
7749093
updated endtoend
panda-stack Jul 25, 2021
3fad677
worked in endtoend
panda-stack Jul 25, 2021
c895bbb
updated e2e
panda-stack Jul 25, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ build

endtoend/node_modules

endtoend/results

7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#FROM openjdk:11
#FROM openjdk:11-slim
FROM adoptopenjdk/openjdk11:x86_64-alpine-jdk-11.0.9_11-slim as build-stage
WORKDIR /usr/src/minima/
COPY gradle gradle
COPY gradlew settings.gradle build.gradle ./
WORKDIR /usr/src/minima/
# Call gradlew before copying the source code to only download the gradle distribution once (layer will be cached)
#RUN ./gradlew --no-daemon -v
RUN ./gradlew --no-daemon -v
COPY lib lib
COPY src src
COPY test test
Expand All @@ -18,6 +18,9 @@ RUN ls -l build/libs/*
RUN stat build/libs/minima-all.jar
#RUN tar -cf minimajar.tar build/libs/minima-all.jar

#FROM openjdk:11-slim as production-stage
#RUN apt-get update
#RUN apt-get install -y curl
FROM adoptopenjdk/openjdk11:x86_64-alpine-jdk-11.0.9_11-slim as production-stage
RUN apk --no-cache add curl
COPY --from=build-stage /usr/src/minima/build/libs/minima-all.jar /opt/minima/minima.jar
Expand Down
11 changes: 8 additions & 3 deletions Dockerfile.arm64v8
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#FROM openjdk:11
#FROM openjdk:11 as build-stage
#FROM adoptopenjdk/openjdk11:x86_64-alpine-jdk-11.0.9_11-slim as build-stage
FROM arm64v8/adoptopenjdk:11-jdk-hotspot-focal as build-stage
WORKDIR /usr/src/minima/
COPY gradle gradle
COPY gradlew settings.gradle build.gradle ./
WORKDIR /usr/src/minima/
# Call gradlew before copying the source code to only download the gradle distribution once (layer will be cached)
#RUN ./gradlew --no-daemon -v
RUN ./gradlew --no-daemon -v
COPY lib lib
COPY src src
COPY test test
Expand All @@ -19,8 +19,12 @@ RUN ls -l build/libs/*
RUN stat build/libs/minima-all.jar
#RUN tar -cf minimajar.tar build/libs/minima-all.jar

# no alpine multi arch images yet, so we build with 11-jdk-hotspot-focal to build a 500 MB image (:11 leads to 700 MB image)
#FROM openjdk:11 as production-stage
#FROM adoptopenjdk/openjdk11:x86_64-alpine-jdk-11.0.9_11-slim as production-stage
FROM arm64v8/adoptopenjdk:11-jdk-hotspot-focal as production-stage
#COPY --from=build-stage /usr/src/minima/build/resources/main/log4j2.xml /opt/minima/log4j2.xml
COPY --from=build-stage /usr/src/minima/src/resources/log4j2.xml /opt/minima/log4j2.xml
COPY --from=build-stage /usr/src/minima/build/libs/minima-all.jar /opt/minima/minima.jar
#COPY --from=build-stage /usr/src/minima/minimajar.tar /opt/minima/minimajar.tar
WORKDIR /opt/minima
Expand All @@ -33,4 +37,5 @@ RUN ls -l *.jar
RUN stat minima.jar
# 9001 minima protocol 9002 REST 9003 WebSocket 9004 MiniDapp Server
EXPOSE 9001 9002 9003 9004
ENTRYPOINT ["java", "-jar", "minima.jar"]
#ENTRYPOINT ["java", "-jar", "minima.jar"]
ENTRYPOINT ["java", "-Dlog4j.configurationFile=log4j2.xml", "-jar", "minima.jar"]
69 changes: 68 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ plugins {
// Apply the java plugin to add support for Java
id 'java'

// Support for kotlin (used by libraries)
id 'org.jetbrains.kotlin.jvm' version '1.4.20'

// Apply the application plugin to add support for building a CLI application.
id 'application'

Expand All @@ -28,8 +31,17 @@ repositories {
// Use jcenter for resolving dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()

maven {
url "https://dl.cloudsmith.io/public/libp2p/jvm-libp2p/maven/"
}
maven {
url "https://artifacts.consensys.net/public/maven/maven/"
}

}


dependencies {
// This dependency is used by the application.
implementation 'com.google.guava:guava:29.0-jre'
Expand All @@ -41,6 +53,44 @@ dependencies {

implementation 'com.jcraft:jsch:0.1.55'

// build and install locally for Apple Silicon
implementation 'com.google.protobuf:protobuf-java:3.11.0'
implementation("org.bouncycastle:bcprov-jdk15on:1.62")
implementation("org.bouncycastle:bcpkix-jdk15on:1.62")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0-M1")

//implementation('io.libp2p:jvm-libp2p-minimal:0.8.1-RELEASE')
implementation 'io.libp2p:jvm-libp2p-minimal:0.8.1-RELEASE'
// implementation 'io.libp2p:jvm-libp2p-minimal'
// compile files('libs/jvm-libp2p-minimal-0.8.0-RELEASE.jar')

api("io.netty:netty-all:4.1.36.Final")

implementation("org.apache.logging.log4j:log4j-api:2.11.2")
implementation("org.apache.logging.log4j:log4j-core:2.11.2")

// below is needed to actually capture the log messages from log4j
implementation group: 'org.slf4j', name: 'slf4j-simple', version: '2.0.0-alpha1' // '1.7.30'

//implementation("org.slf4j:slf4j-api:2.0.0-alpha1")

// Bytes object needed for collections such as KVS
implementation("org.apache.tuweni:bytes:1.3.0")
// commons-lang3 is needed for Pair<,> in ssz
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
// not sure we need the below, as we imported teku fork of tuweni ssz... But maybe we could switch to it.
implementation group: 'org.apache.tuweni', name: 'tuweni-ssz', version: '1.1.0', ext: 'pom'
// https://mvnrepository.com/artifact/org.apache.tuweni/tuweni-units - needed for eth discovery v5 lib (tech.pegasys.discovery)
//implementation group: 'org.apache.tuweni', name: 'tuweni-units', version: '1.1.0', ext: 'pom'
implementation("org.apache.tuweni:units:1.3.0")
// awaitility is used by Waiter.java
implementation group: 'org.awaitility', name: 'awaitility', version: '4.0.3'

implementation 'tech.pegasys.discovery:discovery:0.4.6'
// implementation 'tech.pegasys.discovery:discovery:0.4.3-dev-57c2fd81'


implementation 'com.h2database:h2:1.4.200'
// implementation group: 'com.h2database', name: 'h2', version: '1.4.200'

Expand Down Expand Up @@ -76,9 +126,26 @@ application {
//mainClass.set("org.minima.Start") // new syntax for gradle 6.7+, plugins not compatible yet
}

// alternative main methods - see https://stackoverflow.com/questions/43937169/gradle-application-plugin-with-multiple-main-classes/46938169

// define a task for any alternative static void main method - first arg is gradle task name: ./gradlew runp2p
task(runp2p, dependsOn: 'classes', type: JavaExec) {
main = 'org.minima.system.network.base.P2PStart' // org/minima/system/network/base/P2PStart
classpath = sourceSets.main.runtimeClasspath
// args ''/ip4/127.0.0.1/tcp/63407/ipfs/QmRGduDqyGXEsAGxAw9gM6tZrJbg1NEKSvmqwnjQqKwRVk' // use this line to hardcode args
// systemProperty 'simple.message', 'Hello '
systemProperty 'log4j2.debug', 'false'
// systemProperty 'log4j.configurationFile', 'log4j2-p2p.properties'
systemProperty 'log4j.configurationFile', 'log4j2.xml'
// use below to log to file
// systemProperty "log4j.configurationFile", "log4j2-test-discovery.xml"

}

// needed for log4j to work with fatjar
jar {
manifest {
attributes 'Main-Class': 'org.minima.Start'
attributes "Multi-Release": true
}
}

29 changes: 25 additions & 4 deletions endtoend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
#FROM keymetrics/pm2:latest-alpine
FROM node:15-alpine
FROM node:16-alpine
#FROM node:10
#FROM mhart/alpine-node:15

WORKDIR /app/

# install some packages on Alpine
RUN apk --no-cache add \
python \
bash
python2 \
bash \
build-base \
g++ \
cairo-dev \
jpeg-dev \
pango-dev \
giflib-dev

RUN apk add --update --repository http://dl-3.alpinelinux.org/alpine/edge/testing libmount ttf-dejavu ttf-droid ttf-freefont ttf-liberation ttf-ubuntu-font-family fontconfig

# Copy nodejs package files
COPY package-lock.json package.json /app/
COPY package-lock.json package.json minima-api-1.0.0.tgz /app/

# Install packages
#ENV NPM_CONFIG_LOGLEVEL warn
Expand All @@ -26,4 +34,17 @@ COPY src /app/src

CMD ["node", "src/index.js"]

ARG topology=star
ARG nbNodes=3
ARG nodeFailure=2
ARG graph=false

ENV topology=$topology
ENV nbNodes=$nbNodes
ENV nodeFailure=$nodeFailure
ENV graph=$graph

RUN echo $topology
RUN echo $nbNodes
RUN echo $nodeFailure
RUN echo $graph
9 changes: 4 additions & 5 deletions endtoend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Quick Start
cd minima_root_dir
docker network create minima-e2e-testnet
docker build -t minima:latest . # OR on ARM: docker build -t minima:latest -f Dockerfile.arm64v8 .
cd end2end
cd endtoend
docker build -t minima-e2e . && docker run -v /var/run/docker.sock:/var/run/docker.sock --network minima-e2e-testnet minima-e2e

Setup
Expand All @@ -19,15 +19,14 @@ build minima docker image (or pull it) - default image used is minima:latest
#ARM: docker build -t minima:latest -f Dockerfile.arm64v8 .

build nodejs tests docker image (same for ARM and x64):
cd end2end
docker build -t minima-e2e .
docker build -t minima-e2e endtoend

stop all running docker images (useful to stop instances manually, otherwise script stops automatically old instances at restart):
docker stop $(docker ps -a -q)

run docker instance to create network and perform network connectivity check (requires at least one connection):
docker run -v /var/run/docker.sock:/var/run/docker.sock --network minima-e2e-testnet minima-e2e
docker run -v /var/run/docker.sock:/var/run/docker.sock --env nbNodes=3 --network minima-e2e-testnet minima-e2e

All in one:
docker build -t minima-e2e . && docker run -v /var/run/docker.sock:/var/run/docker.sock --network minima-e2e-testnet minima-e2e
docker build -t minima-e2e endtoend && docker run -v /var/run/docker.sock:/var/run/docker.sock --env nbNodes=3 --network minima-e2e-testnet minima-e2e

Loading