Skip to content

Commit

Permalink
chore!: update spring version (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
ablax authored May 13, 2024
1 parent 20cbd76 commit c7878ae
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 46 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'corretto'
cache: gradle
- name: Validate Gradle wrapper
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
VERSION=${GITHUB_REF_NAME}
echo Releasing version: $VERSION
sed -i -e 's@version = .\d*.\d*.\d*.*@version = "'"$VERSION"'"@g' build.gradle.kts
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'corretto'
cache: gradle
- name: Validate Gradle wrapper
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ cd Fruzhin
### Java Version

Fruzhin only works
with [Java 17 Coretto](https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/downloads-list.html). Using any other
with [Java 21 Coretto](https://docs.aws.amazon.com/corretto/latest/corretto-21-ug/downloads-list.html). Using any other
version may cause "cannot calculate secret" errors when running the node:

```
org.bouncycastle.tls.crypto.TlsCryptoException: cannot calculate secret
```

If you have multiple java version installed please make sure you're using 17:
If you have multiple java version installed please make sure you're using 21:

```
export JAVA_HOME=`/usr/libexec/java_home -v 17.0.8`
export JAVA_HOME=`/usr/libexec/java_home -v 21`
```

### Wasmer-Java dylib setup
Expand Down Expand Up @@ -66,10 +66,9 @@ Copy the file to the Java `Extensions` folder:
### Sync with official chain

```bash
java --enable-preview -jar build/libs/Fruzhin-0.1.0.jar -n polkadot --node-mode full --sync-mode full
java -jar build/libs/Fruzhin-0.1.0.jar -n polkadot --node-mode full --sync-mode full
```

- `--enable-preview` flag is necessary as we are using java preview features
- `-n`(network) could be `westend`, `polkadot` or `kusama`
- `--node-mode` could be `full` or `light`
- `--sync-mode` could be `full` or `warp`
Expand Down
23 changes: 8 additions & 15 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
plugins {
id("java")
id("io.freefair.lombok") version "8.6"
// Can't use newest 3.x version of Spring Boot as it fails to build with jsonprc4j
// See: https://stackoverflow.com/questions/74760350/application-fails-on-run-in-a-new-release-of-springboot-3-0-0
id("org.springframework.boot") version "2.7.3"
id("org.springframework.boot") version "3.2.5"
id("io.spring.dependency-management") version "1.1.5"
id("application")
}
Expand All @@ -14,15 +12,7 @@ application {

group = "com.limechain"
version = "0.1.0"
java.sourceCompatibility = JavaVersion.VERSION_17

tasks.withType<JavaCompile> {
options.compilerArgs.add("--enable-preview")
}

tasks.withType<JavaExec> {
jvmArgs("--enable-preview")
}
java.sourceCompatibility = JavaVersion.VERSION_21

repositories {
mavenCentral()
Expand All @@ -38,7 +28,7 @@ dependencies {

testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.3")
testImplementation("org.mockito:mockito-core:5.11.0")
testImplementation("org.mockito:mockito-core:5.12.0")

// CLI
implementation("commons-cli:commons-cli:1.7.0")
Expand Down Expand Up @@ -71,7 +61,10 @@ dependencies {

// Nabu
// implementation("com.github.LimeChain:nabu:master-SNAPSHOT") // Uncomment for "most-recent on the master branch"
implementation("com.github.LimeChain:nabu:16c6586")
implementation("com.github.LimeChain:nabu:32f159f413")

//JSON-RPC
implementation("com.github.LimeChain:jsonrpc4j:aefaade0c5")

// Guava
implementation("com.google.guava:guava:33.2.0-jre")
Expand All @@ -83,5 +76,5 @@ dependencies {

tasks.getByName<Test>("test") {
useJUnitPlatform()
jvmArgs("--enable-preview")
jvmArgs("-Dnet.bytebuddy.experimental=true")
}
10 changes: 5 additions & 5 deletions docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ git clone https://github.com/LimeChain/Fruzhin.git
cd Fruzhin
```

#### Install java 17 corretto (if you don't already have it)
#### Install java 21 corretto (if you don't already have it)
Setup guide:
- [Windows](https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/windows-install.html)
- [Linux](https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/generic-linux-install.html)
- [Mac](https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/macos-install.html)
- [Windows](https://docs.aws.amazon.com/corretto/latest/corretto-21-ug/windows-install.html)
- [Linux](https://docs.aws.amazon.com/corretto/latest/corretto-21-ug/generic-linux-install.html)
- [Mac](https://docs.aws.amazon.com/corretto/latest/corretto-21-ug/macos-install.html)

#### Build project

Expand All @@ -43,7 +43,7 @@ If exception is thrown you will have to manually grab the compiled wasmer-java d
Run the following command to start the blockchain node:

```bash
./java --enable-preview -jar build/libs/Fruzhin-0.1.0.jar -n polkadot --node-mode full --sync-mode full
./java -jar build/libs/Fruzhin-0.1.0.jar -n polkadot --node-mode full --sync-mode full
```

## Contributing
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
18 changes: 14 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -205,6 +209,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
15 changes: 9 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
Binary file removed libs/jsonrpc4j-1.6.2-SNAPSHOT.jar
Binary file not shown.
1 change: 0 additions & 1 deletion src/test/java/com/limechain/config/HostConfigTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.springframework.test.util.ReflectionTestUtils.setField;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.MockedStatic;
import org.mockito.Mockito;
import org.mockito.Spy;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.test.util.ReflectionTestUtils;
Expand Down Expand Up @@ -33,8 +34,7 @@ class FreeingBumpHeapAllocatorTest {

@Mock
private Memory memory;
@Mock
private ByteBuffer buffer;
private ByteBuffer buffer = Mockito.spy(ByteBuffer.allocate(1000));

@Mock
private List<Order> orders;
Expand Down
2 changes: 1 addition & 1 deletion zombienet/0001-light-client-header-verification.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[relaychain]
chain = "westend-local"
default_command = "java --enable-preview -jar build/libs/fruzhin-0.1.0.jar"
default_command = "java -jar build/libs/fruzhin-0.1.0.jar"
default_args = ["-n westend -dbc --node-mode light"]
chain_spec_path = "genesis/westend-raw.json"

Expand Down
2 changes: 1 addition & 1 deletion zombienet/0002-peer-discovery.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[relaychain]
chain = "westend-local"
default_command = "java --enable-preview -jar build/libs/fruzhin-0.1.0.jar"
default_command = "java -jar build/libs/fruzhin-0.1.0.jar"
default_args = ["-n westend -dbc"]
chain_spec_path = "genesis/westend-raw.json"

Expand Down
2 changes: 1 addition & 1 deletion zombienet/0003-block-execution.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[relaychain]
chain = "westend-local"
default_command = "java --enable-preview -jar build/libs/fruzhin-0.1.0.jar"
default_command = "java -jar build/libs/fruzhin-0.1.0.jar"
default_args = ["-n westend --node-mode full --db-recreate --sync-mode full"]
chain_spec_path = "genesis/westend-raw.json"

Expand Down

0 comments on commit c7878ae

Please sign in to comment.