Skip to content

Commit

Permalink
Merge pull request #39 from HorizenOfficial/development
Browse files Browse the repository at this point in the history
0.2.0 to main
  • Loading branch information
paolocappelletti authored Jul 26, 2023
2 parents 5e21316 + 51a4e97 commit 895d65c
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 17 deletions.
11 changes: 10 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
os: linux
dist: jammy
dist: focal
language: generic
addons:
apt:
Expand Down Expand Up @@ -34,3 +34,12 @@ jobs:
env:
- EVMAPP_DOCKER_IMAGE_NAME='evmapp'
- BOOTSTRAPTOOL_DOCKER_IMAGE_NAME='evmapp-bootstraptool'

deploy:
provider: releases
token: $GITHUB_TOKEN
prerelease: $IS_A_GH_PRERELEASE
overwrite: true
on:
tags: true
condition: $IS_A_RELEASE = true
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Changelog
## 0.2.0
* Updated SDK dependency to 0.7.1

## 0.1.0
Initial version of the EON application.
Expand Down
8 changes: 4 additions & 4 deletions bootstraptool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.horizen</groupId>
<artifactId>bootstraptool</artifactId>
<version>0.1.0</version>
<version>0.2.0</version>
<inceptionYear>2023</inceptionYear>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -16,18 +16,18 @@
<dependency>
<groupId>io.horizen</groupId>
<artifactId>sidechains-sdk-scbootstrappingtools</artifactId>
<version>0.7.0</version>
<version>0.7.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.horizen</groupId>
<artifactId>sidechains-sdk-account_sctools</artifactId>
<version>0.7.0</version>
<version>0.7.1</version>
</dependency>
<dependency>
<groupId>io.horizen</groupId>
<artifactId>eon</artifactId>
<version>0.1.0</version>
<version>0.2.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
20 changes: 15 additions & 5 deletions ci/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ pom_version="${ROOT_POM_VERSION:-}"

DOCKER_USERNAME="${DOCKER_USERNAME:-}"
DOCKER_PASSWORD="${DOCKER_PASSWORD:-}"
IS_A_RELEASE="${IS_A_RELEASE:-false}"
PROD_RELEASE="${PROD_RELEASE:-false}"
TRAVIS_TAG="${TRAVIS_TAG:-}"


# Functions
Expand Down Expand Up @@ -45,23 +48,30 @@ if [ -n "${docker_tag}" ]; then
.

# Publishing to DockerHub
echo "" && echo "=== Publishing Docker image(s) on Docker Hub===" && echo ""
echo "" && echo "=== Publishing Docker image(s) on Docker Hub ===" && echo ""
if [ -z "${DOCKER_USERNAME}" ] || [ -z "${DOCKER_PASSWORD}" ]; then
echo "Warning: DOCKER_USERNAME and/or DOCKER_USERNAME is(are) empty. Docker image is NOT going to be published on DockerHub !!!"
echo "Warning: DOCKER_USERNAME and/or DOCKER_PASSWORD variable(s) is(are) empty. Docker image(s) is(are) NOT going to be published on DockerHub !!!"
else
echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
echo "Create tags"
docker_images=("${evmapp_docker_image_name}" "${bootstraptool_docker_image_name}")
for docker_image in "${docker_images[@]}"; do

# Docker image(s) tags for PROD vs DEV release
if [ "${PROD_RELEASE}" = "true" ]; then
tags=("${docker_tag}" "latest")
else
tags=("${docker_tag}" "dev")
fi

for docker_image in "${docker_images[@]}"; do
for tag in "${tags[@]}"; do
echo "" && echo "Publishing docker image: ${docker_image}:${tag}"
docker tag "${docker_image}:${docker_tag}" "index.docker.io/${docker_hub_org}/${docker_image}:${tag}"
docker push "index.docker.io/${docker_hub_org}/${docker_image}:${tag}"
done
done
fi
else
echo "" && echo "=== The build did NOT satisfy RELEASE build requirements. Docker image is not being created ===" && echo ""
echo "" && echo "=== The build did NOT satisfy RELEASE build requirements. Docker image(s) was(were) NOT created/published ===" && echo ""
fi


Expand Down
15 changes: 13 additions & 2 deletions ci/setup_env.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash
set -eo pipefail

export IS_A_RELEASE="false"
IS_A_RELEASE="false"
IS_A_GH_PRERELEASE="false"
PROD_RELEASE="false"

ROOT_POM_VERSION="$(xpath -q -e '/project/version/text()' pom.xml)"
node_pom_version="$(xpath -q -e '/project/version/text()' ./node/pom.xml)"
bootstraptool_pom_version="$(xpath -q -e '/project/version/text()' ./bootstraptool/pom.xml)"
Expand Down Expand Up @@ -97,6 +100,9 @@ if [ -n "${TRAVIS_TAG}" ]; then

if [ "${IS_A_RELEASE}" = "true" ]; then
echo "" && echo "=== Production release ===" && echo ""

export PROD_RELEASE="true"
export IS_A_GH_PRERELEASE="false"
fi
elif ( git branch -r --contains "${TRAVIS_TAG}" | grep -xqE ". origin\/${DEV_RELEASE_BRANCH}$" ); then
import_gpg_keys "${all_maintainers_keys}"
Expand All @@ -105,7 +111,7 @@ if [ -n "${TRAVIS_TAG}" ]; then

if ! [[ "${ROOT_POM_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-RC[0-9]+)?(-SNAPSHOT){1}$ ]]; then
echo "Warning: package(s) version is in the wrong format for DEVELOPMENT release. Expecting: d.d.d(-RC[0-9]+)?(-SNAPSHOT){1}. The build is not going to be released !!!"
IS_A_RELEASE="false"
export IS_A_RELEASE="false"
fi

# Checking Github tag format
Expand All @@ -117,13 +123,18 @@ if [ -n "${TRAVIS_TAG}" ]; then

if [ "${IS_A_RELEASE}" = "true" ]; then
echo "" && echo "=== Development release ===" && echo ""

export PROD_RELEASE="false"
export IS_A_GH_PRERELEASE="true"
fi
fi
fi

# Final check for release vs non-release build
if [ "${IS_A_RELEASE}" = "false" ]; then
echo "" && echo "=== NOT a release build ===" && echo ""

export IS_A_RELEASE="false"
fi

set +eo pipefail
7 changes: 5 additions & 2 deletions dockerfiles/evmapp/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,15 @@ to_check=(
"SCNODE_NET_API_LIMITER_ENABLED"
"SCNODE_NET_SLOW_MODE"
"SCNODE_NET_REBROADCAST_TXS"
"SCNODE_NET_HANDLING_TXS"
"SCNODE_REST_PORT"
"SCNODE_WALLET_SEED"
"SCNODE_WALLET_MAXTX_FEE"
"SCNODE_WS_SERVER_PORT"
"SCNODE_WS_CLIENT_ENABLED"
"SCNODE_WS_SERVER_ENABLED"
"SCNODE_REMOTE_KEY_MANAGER_PARALLEL_REQUESTS"
"SCNODE_REMOTE_KEY_MANAGER_REQUEST_TIMEOUT"
)
for var in "${to_check[@]}"; do
if [ -z "${!var:-}" ]; then
Expand Down Expand Up @@ -255,9 +258,9 @@ export SCNODE_NET_KNOWNPEERS
SUBST='$SCNODE_CERT_MASTERS_PUBKEYS:$SCNODE_CERT_SIGNERS_MAXPKS:$SCNODE_CERT_SIGNERS_PUBKEYS:$SCNODE_CERT_SIGNERS_SECRETS:$SCNODE_CERT_SIGNERS_THRESHOLD:$SCNODE_CERT_SIGNING_ENABLED:'\
'$SCNODE_CERT_SUBMITTER_ENABLED:$SCNODE_GENESIS_BLOCKHEX:$SCNODE_GENESIS_SCID:$SCNODE_GENESIS_POWDATA:$SCNODE_GENESIS_MCBLOCKHEIGHT:$SCNODE_GENESIS_MCNETWORK:'\
'$SCNODE_GENESIS_WITHDRAWALEPOCHLENGTH:$SCNODE_GENESIS_COMMTREEHASH:$SCNODE_GENESIS_ISNONCEASING:$SCNODE_ALLOWED_FORGERS:$SCNODE_FORGER_ENABLED:$SCNODE_FORGER_RESTRICT:'\
'$SCNODE_NET_DECLAREDADDRESS:$SCNODE_NET_KNOWNPEERS:$SCNODE_NET_MAGICBYTES:$SCNODE_NET_NODENAME:$SCNODE_NET_P2P_PORT:$SCNODE_NET_API_LIMITER_ENABLED:$SCNODE_NET_SLOW_MODE:$SCNODE_NET_REBROADCAST_TXS:'\
'$SCNODE_NET_DECLAREDADDRESS:$SCNODE_NET_KNOWNPEERS:$SCNODE_NET_MAGICBYTES:$SCNODE_NET_NODENAME:$SCNODE_NET_P2P_PORT:$SCNODE_NET_API_LIMITER_ENABLED:$SCNODE_NET_SLOW_MODE:$SCNODE_NET_REBROADCAST_TXS:$SCNODE_NET_HANDLING_TXS:'\
'$SCNODE_WALLET_GENESIS_SECRETS:$SCNODE_WALLET_MAXTX_FEE:$SCNODE_WALLET_SEED:$WS_ADDRESS:$MAX_INCOMING_CONNECTIONS:$MAX_OUTGOING_CONNECTIONS:$SCNODE_WS_SERVER_PORT:'\
'$SCNODE_WS_CLIENT_ENABLED:$SCNODE_WS_SERVER_ENABLED:$SCNODE_REMOTE_KEY_MANAGER_ENABLED:$SCNODE_REMOTE_KEY_MANAGER_ADDRESS:$SCNODE_LOG_FILE_LEVEL:$SCNODE_LOG_CONSOLE_LEVEL:'\
'$SCNODE_WS_CLIENT_ENABLED:$SCNODE_WS_SERVER_ENABLED:$SCNODE_REMOTE_KEY_MANAGER_ENABLED:$SCNODE_REMOTE_KEY_MANAGER_ADDRESS:$SCNODE_LOG_FILE_LEVEL:$SCNODE_LOG_CONSOLE_LEVEL:$SCNODE_REMOTE_KEY_MANAGER_REQUEST_TIMEOUT:$SCNODE_REMOTE_KEY_MANAGER_PARALLEL_REQUESTS:'\
'$SCNODE_REST_APIKEYHASH:$SCNODE_REST_PORT'\

export SUBST
Expand Down
3 changes: 3 additions & 0 deletions dockerfiles/evmapp/sc_settings.conf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ sparkz {
rebroadcastDelay = 30s
rebroadcastQueueSize = 1024
rebroadcastBatchSize = 75
handlingTransactionsEnabled = $SCNODE_NET_HANDLING_TXS
}

apiRateLimiter {
Expand Down Expand Up @@ -86,6 +87,8 @@ sparkz {
remoteKeysManager {
enabled = $SCNODE_REMOTE_KEY_MANAGER_ENABLED
address = "$SCNODE_REMOTE_KEY_MANAGER_ADDRESS"
requestTimeout = $SCNODE_REMOTE_KEY_MANAGER_REQUEST_TIMEOUT
numOfParallelRequests = $SCNODE_REMOTE_KEY_MANAGER_PARALLEL_REQUESTS
}

genesis {
Expand Down
4 changes: 2 additions & 2 deletions node/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.horizen</groupId>
<artifactId>eon</artifactId>
<version>0.1.0</version>
<version>0.2.0</version>
<inceptionYear>2023</inceptionYear>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.plugin>3.8.1</maven.compiler.plugin>
<maven.dependency.plugin>3.1.1</maven.dependency.plugin>
<sidechain.sdk.version>0.7.0</sidechain.sdk.version>
<sidechain.sdk.version>0.7.1</sidechain.sdk.version>
</properties>
<dependencies>
<dependency>
Expand Down
20 changes: 20 additions & 0 deletions node/src/main/java/io/horizen/eon/EonAppModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,25 @@ public void configureApp() {
bind(Integer.class)
.annotatedWith(Names.named("ConsensusSecondsInSlot"))
.toInstance(CONSENSUS_SLOT_TIME);

bind(String.class)
.annotatedWith(Names.named("AppVersion"))
.toInstance(getEONVersion());
}

/**
Retrieves the EON version by dynamically accessing the implementation version of the package at runtime.
The implementation version is taken from the JAR file's manifest file <b>Implementation-Version</b> attribute. That attribute
is populated when JAR is built with the value of the version tag under the project key from the pom file. <br/>
When running the application in a development environment (e.g., directly from the source code or an IDE), the implementation
version is not accessible and will return the default "dev" value.
@return The EON version, or "dev" if the version is not available.
*/
public String getEONVersion() {
String defaultVersion = "dev";
Package eonPackage = this.getClass().getPackage();
String version = eonPackage.getImplementationVersion();
return version != null ? version : defaultVersion;
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.horizen</groupId>
<artifactId>eonproject</artifactId>
<version>0.1.0</version>
<version>0.2.0</version>
<packaging>pom</packaging>
<inceptionYear>2023</inceptionYear>
<properties>
Expand Down

0 comments on commit 895d65c

Please sign in to comment.