Skip to content

Commit

Permalink
Merge pull request #1045 from HorizenOfficial/dev
Browse files Browse the repository at this point in the history
0.12.0 to master
  • Loading branch information
paolocappelletti authored Jun 18, 2024
2 parents 1d412b7 + 5dac3e7 commit c350ec0
Show file tree
Hide file tree
Showing 180 changed files with 13,106 additions and 785 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
**0.12.0**
1. Sparkz dependency updated to 2.4.0
* Updates in EON forger nodes connection policy (see release notes for further info)
2. New stake management support (see release notes for further info)
3. Reward from mainchain - new rules (see release notes for further info)
4. Added metrics endpoint
5. Minor fixes:
* [eth RPC endpoint] web3_clientVersion now returns also the EON version
* [eth RPC endpoint] Better error handling: in case of error the response status code will be 400 instead of 200
* [eth RPC endpoint] In case of batch requests, the response is now always an array, even with a batch composed of only one element.

**0.11.0**
1. Sparkz dependency updated to 2.3.0
2. Updated third-party dependencies
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ While we keep monitoring the memory footprint of the proofs generation process,
- After the installation, just run `export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1` before starting the sidechain node, or run the sidechain node adding `LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1` at the beginning of the java command line as follows:

```
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1 java -cp ./target/sidechains-sdk-simpleapp-0.11.0.jar:./target/lib/* io.horizen.examples.SimpleApp <path_to_config_file>
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1 java -cp ./target/sidechains-sdk-simpleapp-0.12.0.jar:./target/lib/* io.horizen.examples.SimpleApp <path_to_config_file>
```
- In the folder `ci` you will find the script `run_sc.sh` to automatically check and use jemalloc library while starting the sidechain node.

Expand Down
7 changes: 5 additions & 2 deletions ci/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ function publish_project () {

# Building and publishing
cd "${project}"
if [[ "${TRAVIS_TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-RC[0-9]+)?(-SNAPSHOT){1}[0-9]*$ ]]; then
if [[ "${TRAVIS_TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-SNAPSHOT){1}[0-9]*$ ]]; then
echo "" && echo "=== Publishing DEVELOPMENT release of '${project}' project on Sonatype Nexus repository. Timestamp is: $(date '+%a %b %d %H:%M:%S %Z %Y') ===" && echo ""
mvn deploy -P sign,build-extras --settings "${workdir}"/ci/mvn_settings.xml -DskipTests=true -B || { retval="$?"; echo "Error: was not able to publish ${project} project version = ${TRAVIS_TAG} on public repository."; }
elif [[ "${TRAVIS_TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-RC[0-9]+)?$ ]]; then
elif [[ "${TRAVIS_TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-RC[0-9]+){1}$ ]]; then
echo "" && echo "=== Publishing RC release of '${project}' project on Maven repository. Timestamp is: $(date '+%Y-%m-%d %H:%M') ===" && echo ""
mvn deploy -P sign,build-extras --settings "${workdir}"/ci/mvn_settings.xml -DskipTests=true -B || { retval="$?"; echo "Error: was not able to publish ${project} project version = ${TRAVIS_TAG} on public repository."; }
elif [[ "${TRAVIS_TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]$ ]]; then
echo "" && echo "=== Publishing PRODUCTION release of '${project}' project on Maven repository. Timestamp is: $(date '+%Y-%m-%d %H:%M') ===" && echo ""
mvn deploy -P sign,build-extras --settings "${workdir}"/ci/mvn_settings.xml -DskipTests=true -B || { retval="$?"; echo "Error: was not able to publish ${project} project version = ${TRAVIS_TAG} on public repository."; }
else
Expand Down
2 changes: 1 addition & 1 deletion ci/run_sc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -eo pipefail

SIMPLE_APP_VERSION="${SIMPLE_APP_VERSION:-0.11.0}"
SIMPLE_APP_VERSION="${SIMPLE_APP_VERSION:-0.12.0}"

if [ -d "$1" ] && [ -f "$2" ]; then
path_to_jemalloc="$(ldconfig -p | grep "$(arch)" | grep 'libjemalloc\.so\.1$' | tr -d ' ' | cut -d '>' -f 2)"
Expand Down
34 changes: 22 additions & 12 deletions ci/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ if [ -n "${TRAVIS_TAG}" ]; then
for release_branch in "${prod_release_br_list[@]}"; do
if ( git branch -r --contains "${TRAVIS_TAG}" | grep -xqE ". origin\/${release_branch}$" ); then
# Checking format of production release pom version
if ! [[ "${root_pom_version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-RC[0-9]+)?$ ]]; then
echo "Warning: package(s) version is in the wrong format for PRODUCTION release. Expecting: d.d.d(-RC[0-9]+)?. The build is not going to be released !!!"
if ! [[ "${root_pom_version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Warning: package(s) version is in the wrong format for PRODUCTION release. Expecting: d.d.d. The build is not going to be released !!!"
export IS_A_RELEASE="false"
fi

Expand All @@ -151,19 +151,29 @@ if [ -n "${TRAVIS_TAG}" ]; then
# DEV release
if [ "${PROD_RELEASE}" = "false" ]; then
# Checking if package version matches DEV release version
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 !!!"
export IS_A_RELEASE="false"
fi

# Checking Github tag format
if ! [[ "${TRAVIS_TAG}" =~ "${root_pom_version}"[0-9]*$ ]]; then
echo "" && echo "=== Warning: GIT tag format differs from the pom file version. ===" && echo ""
echo -e "Github tag name: ${TRAVIS_TAG}\nPom file version: ${root_pom_version}.\nThe build is not going to be released !!!"
if [[ "${root_pom_version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-SNAPSHOT){1}$ ]]; then
if [[ "${TRAVIS_TAG}" =~ "${root_pom_version}"[0-9]*$ ]]; then
echo "" && echo "=== Development release ===" && echo ""
export IS_A_RELEASE="true"
else
echo "" && echo "=== Warning: GIT tag format differs from the pom file version. ===" && echo ""
echo -e "Github tag name: ${TRAVIS_TAG}\nPom file version: ${root_pom_version}.\nThe build is not going to be released !!!"
export IS_A_RELEASE="false"
fi
elif [[ "${root_pom_version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-RC[0-9]+){1}$ ]]; then
if [[ "${TRAVIS_TAG}" == "${root_pom_version}" ]]; then
echo "" && echo "=== RC release ===" && echo ""
export IS_A_RELEASE="true"
else
echo "" && echo "=== Warning: GIT tag format differs from the pom file version. ===" && echo ""
echo -e "Github tag name: ${TRAVIS_TAG}\nPom file version: ${root_pom_version}.\nThe build is not going to be released !!!"
export IS_A_RELEASE="false"
fi
else
echo "Warning: package(s) version is in the wrong format for DEVELOPMENT or RC release. Expecting: d.d.d(-SNAPSHOT){1} or d.d.d(-RC[0-9]+){1}. The build is not going to be released !!!"
export IS_A_RELEASE="false"
fi

# Announcing DEV release
if [ "${IS_A_RELEASE}" = "true" ]; then
export PROD_RELEASE="false"
export IS_A_GH_PRERELEASE="true"
Expand Down
2 changes: 1 addition & 1 deletion coverage-reports/generate_report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# this script should be run in the root of coverage-reports folder

# Specify snapshot version
SNAPSHOT_VERSION_TAG="0.11.0"
SNAPSHOT_VERSION_TAG="0.12.0"

# Check if SIDECHAIN_SDK is set and not empty
if [ -z "$SIDECHAIN_SDK" ]; then
Expand Down
1 change: 1 addition & 0 deletions doc/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Horizen Sidechain SDK Release Notes

## Version [0.12.0](/doc/release/0.12.0.md)
## Version [0.11.0](/doc/release/0.11.0.md)
## Version [0.10.1](/doc/release/0.10.1.md)
## Version [0.10.0](/doc/release/0.10.0.md)
Expand Down
133 changes: 133 additions & 0 deletions doc/release/0.12.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Release notes - version 0.12.0

---

## Notes about new/updated Features

### Stake V2

Support for new stake management, with two main targets:

- Switch from a “UTXO based” to an “Account based” model (no more stakeId assigned to each delegation operation, but just a balance assigned to each pair [forger,delegator])
- Allow the possibility to redirect earnings to a smart-contract, which will be responsible for rewards distribution among the delegators.

Notable changes:
- The old stake native smart contract will be deprecated/deactivated.
A new native smart contract will be activated.
Methods exposed will allow to:

- Introduce a preliminary mandatory registration step for forgers: will be performed by executing a transaction declaring the forger public keys (VRF key and block sign key), the percentage of rewards to be redirected to a smart contract responsible to manage the delegators’ rewards (named “reward share”), and the address of that smart contract. (The last two fields will be optional).
An additional signature will be required with the method to prove the sender is the effective owner of the forger keys: for this reason the preferred way is to use the new http endpoint /transaction/registerForger to invoke the tx based on the local wallet data (it will handle automatically the additional signature). A method is also available in the native smart contract, but currently there is no way to generate a vrf signature from outside the node (it requires the cryptolib, and we don’t have the layer to invoke it from javascript)
- A minimum amount of 10 ZEN will be required to be sent with the transaction: it will be converted automatically into the first stake assigned to the forger.
- The registration step will not be required for existing forgers owning a stake before the hardfork: they will be automatically added to the list of registered ones, with “reward share” = 0 and “smart contract address” = none.
- Introduce an updateForger() method to allow forgers with “reward share” = 0 and “smart contract address” = none to update the fields. The update will be allowed only one time: once set, the values will be immutable. This protects delegators from distribution mechanisms being changed without their knowledge.
- Modify the consensus lottery to consider only forgers owning an amount of stakes (directly or delegated) equals or over to 10 ZEN.

The following changes will happen in the http endpoints:
- /transaction/allForgingStakes and /transaction/myForgingStakes
Same format as now, but the output field stakeId will no more be present
- /transaction/makeForgerStake<br>
**DEPRECATED** (creation of a new stake will be doable only by calling the native smart contract method delegate)
- /transaction/spendForgingStake<br>
**DEPRECATED** (withdraw of a stake will be doable only by calling the native smart contract method withdraw)

The following addition will be included in:<br>

Endpoint: /block/getFeePayments <br>
Rpc endpoint: zen_getFeePayments<br>

Their result will keep the same format as now, but will also include the reward paid to the address of the smart contracts (if defined).

We will also detail the amount coming from the mainchain redistribution: to be retrocompatible they will be into additional fields valueFromMainchain and valueFromFees:

```
{
"result" : {
"feePayments" : [
{
"address" : "c49dedc85a2c360fea781bcea2bc5d58fde19",
"value" : 2000000 -> total
"valueFromMainchain:": 500000 -> part from the mainchain
"valueFromFees": 1500000 -> part from the fees
}
]
}
}
```
### Reward from mainchain - new rules

The maximum ZEN amount redistributed to forgers from the special address 0x000000000000000000003333333333333333333 in a single withdrawal epoch is now limited to a maximum value expressed by the following formula:

- MAX_VALUE_REDISTRIBUTED = sum [10% of Mainchain’s block-reward Coinbase of each mainchain block reference included in the withdrawal epoch]

- Funds over the limit will stay in the address balance and will be redistributed in the following epochs.

For example:<br>
Current Mainchain block reward: 6.25 ZEN<br>
Number of mainchain block-reference in a withdrawal epoch: 100<br>
MAX_VALUE_REDISTRIBUTED = 10%(6.25) * 100 = 62.5 ZEN<br>

### Updates in RPC endpoints

- web3_clientVersion now returns also the EON version, in the following format:
EON_VERSION/SDK_VERSION/ARCHITECTURE/JAVA_VERSION

- Better error handling: in case of error the response status code will be 400 instead of 200.

- In case of batch requests, the response is now always an array, even with a batch composed of only one element. Previously, if the batch request was composed by only one element, the response was an object.

### New metrics endpoint
A new endpoint can be optionally exposed (on a different port from the serverAPI) to show some node metrics.
To configure it, you can add the following new fragment in the settings file (fragment is optional, the value displayed are the defaults):
```
metricsApi {
enabled = false
bindAddress = "127.0.0.1:9088"
timeout = 5s
#apiKeyHash = ""
}
```

Format:

The metrics will be exposed in a http endpoint /metrics, in Prometheus format, one line per metric, in this format:

```
metric_id value
```

Available metrics:

Following metrics will be available (also listed in the endpoint /metrics/help):

- **block_apply_time**<br>
Time to apply block to node wallet and state (milliseconds)
- **block_apply_time_fromslotstart**<br>
Delta between timestamp when block has been applied successfully on this node and start timestamp of the slot it belongs to (milliseconds)
- **block_applied_ok**<br>
Number of received blocks applied successfully (absolute value since start of the node)
- **block_applied_ko**<br>
Number of received blocks not applied (absolute value since start of the node)
- **mempool_size**<br>
Mempool size (number of transactions in this node mempool)
- **forge_block_count**<br>
Number of forged blocks by this node (absolute value since start of the node)
- **forge_lottery_time**<br>
Time to execute the lottery (milliseconds)
- **forge_blockcreation_time**<br>
Time to create a new forged block (calculated from the start timestamp of the slot it belongs to) (milliseconds)

### Updates in EON forger nodes connection policy

Default value for the property:

maxForgerConnections

Has been increased from 20 to 100.
(Remember this only applies if no value is set explicitly in conf / docker env).

Furthermore, the dedicated connection pool for forgers nodes (governed by the above property) now only applies if the node is itself a forger.

---
Full [Changelog](/CHANGELOG.md) file here

10 changes: 5 additions & 5 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,24 @@ Otherwise, to run an Example App outside the IDE:
* (Windows)
```
cd Sidechains-SDK\examples\simpleapp
java -cp ./target/sidechains-sdk-simpleapp-0.11.0.jar;./target/lib/* io.horizen.examples.SimpleApp <path_to_config_file>
java -cp ./target/sidechains-sdk-simpleapp-0.12.0.jar;./target/lib/* io.horizen.examples.SimpleApp <path_to_config_file>
```
* (Linux)
```
cd ./Sidechains-SDK/examples/utxo/simpleapp
java -cp ./target/sidechains-sdk-simpleapp-0.11.0.jar:./target/lib/\* io.horizen.examples.SimpleApp <path_to_config_file>
java -cp ./target/sidechains-sdk-simpleapp-0.12.0.jar:./target/lib/\* io.horizen.examples.SimpleApp <path_to_config_file>
```
**Model: Account**
* (Windows)
```
cd Sidechains-SDK\examples\evmapp
java -cp ./target/sidechains-sdk-evmapp-0.11.0.jar;./target/lib/* io.horizen.examples.EvmApp <path_to_config_file>
java -cp ./target/sidechains-sdk-evmapp-0.12.0.jar;./target/lib/* io.horizen.examples.EvmApp <path_to_config_file>
```
* (Linux)
```
cd ./Sidechains-SDK/examples/account/evmapp
java -cp ./target/sidechains-evmapp-0.11.0.jar:./target/lib/\* io.horizen.examples.EvmApp <path_to_config_file>
java -cp ./target/sidechains-evmapp-0.12.0.jar:./target/lib/\* io.horizen.examples.EvmApp <path_to_config_file>
```
On some Linux OSs during backward transfers certificates proofs generation an extremely large RAM consumption may happen, that will lead to the process being force killed by the OS.
Expand All @@ -74,7 +74,7 @@ While we keep monitoring the memory footprint of the proofs generation process,
- After the installation, just run `export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1` before starting the sidechain node, or run the sidechain node adding `LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1` at the beginning of the java command line as follows:
```
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1 java -cp ./target/sidechains-sdk-simpleapp-0.11.0.jar:./target/lib/* io.horizen.examples.SimpleApp <path_to_config_file>
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1 java -cp ./target/sidechains-sdk-simpleapp-0.12.0.jar:./target/lib/* io.horizen.examples.SimpleApp <path_to_config_file>
```
- In the folder `ci` you will find the script `run_sc.sh` to automatically check and use jemalloc library while starting the sidechain node.
Expand Down
4 changes: 2 additions & 2 deletions examples/account/evmapp/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>sidechains-sdk-evmapp</artifactId>
<version>0.11.0</version>
<version>0.12.0</version>
<inceptionYear>2022</inceptionYear>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -15,7 +15,7 @@
<dependency>
<groupId>io.horizen</groupId>
<artifactId>sidechains-sdk</artifactId>
<version>0.11.0</version>
<version>0.12.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ public List<Pair<SidechainForkConsensusEpoch, OptionalSidechainFork>> getOptiona
new Pair<>(
new SidechainForkConsensusEpoch(70, 70, 70),
new Version1_3_0Fork(true)
),
new Pair<>(
new SidechainForkConsensusEpoch(80, 80, 80),
new Version1_4_0Fork(true)
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public List<Pair<SidechainForkConsensusEpoch, OptionalSidechainFork>> getOptiona
new Pair<>(
new SidechainForkConsensusEpoch(2, 2, 2),
new Version1_3_0Fork(true)
),
new Pair<>(
new SidechainForkConsensusEpoch(2, 2, 2),
new Version1_4_0Fork(true)
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ sparkz {
bindAddress = "127.0.0.1:9085"
timeout = 5s
}
metricsApi {
enabled = true
bindAddress = "127.0.0.1:9089"
timeout = 5s
}


network {
nodeName = "testNode1"
Expand Down
6 changes: 3 additions & 3 deletions examples/account/evmapp_sctool/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>sidechains-sdk-evmapp_sctool</artifactId>
<version>0.11.0</version>
<version>0.12.0</version>
<inceptionYear>2022</inceptionYear>
<properties>
<maven.compiler.source>11</maven.compiler.source>
Expand All @@ -14,13 +14,13 @@
<dependency>
<groupId>io.horizen</groupId>
<artifactId>sidechains-sdk-scbootstrappingtools</artifactId>
<version>0.11.0</version>
<version>0.12.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.horizen</groupId>
<artifactId>sidechains-sdk-evmapp</artifactId>
<version>0.11.0</version>
<version>0.12.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
Loading

0 comments on commit c350ec0

Please sign in to comment.