From 28e68f388d9f2add67aae70d1429d31432fcd1df Mon Sep 17 00:00:00 2001 From: Alfonso Bribiesca Date: Mon, 5 Aug 2024 02:45:09 -0600 Subject: [PATCH] feat: update dependencies (#177) --- .github/workflows/release.yml | 4 +- .github/workflows/test.yml | 79 +++--- .vscode/settings.json | 4 + build.gradle | 62 ++--- gradle/wrapper/gradle-wrapper.properties | 2 +- .../java/org/arkecosystem/crypto/Schnorr.java | 3 +- .../FixtureSignVerificationTest.java | 233 +++++++++--------- 7 files changed, 193 insertions(+), 194 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1761f28d..ab13ee3b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,8 +23,8 @@ jobs: - name: Set up Java uses: actions/setup-java@v2 with: - java-version: '8' - distribution: 'adopt' + java-version: "22" + distribution: "adopt" - name: Publish to the Maven Central Repository run: gradle publish diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6aa0bd63..315aa052 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,65 +6,64 @@ on: - "master" - "develop" pull_request: - types: [ ready_for_review, synchronize, opened ] + types: [ready_for_review, synchronize, opened] jobs: format: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - ref: ${{ github.head_ref }} + - name: Checkout code + uses: actions/checkout@v2 + with: + ref: ${{ github.head_ref }} - - name: Merge Conflict finder - uses: olivernybroe/action-conflict-finder@v1.1 + - name: Merge Conflict finder + uses: olivernybroe/action-conflict-finder@v1.1 - - name: Use Java Version ${{ matrix.java }} - uses: actions/setup-java@v2 - with: - distribution: 'adopt' - java-version: 8 - cache: 'gradle' + - name: Use Java Version ${{ matrix.java }} + uses: actions/setup-java@v2 + with: + distribution: "adopt" + java-version: 22 + cache: "gradle" - - name: Format code - run: gradle format + - name: Format code + run: gradle format - - name: Commit fixed code - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: "style: resolve style guide violations" - branch: ${{ github.head_ref }} + - name: Commit fixed code + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "style: resolve style guide violations" + branch: ${{ github.head_ref }} unit: runs-on: ubuntu-latest strategy: matrix: - # test against the latest update of each major Java version, as well as specific updates of LTS versions: - java: [ 8, 11, 15, 16, 17 ] + java: [11, 15, 16, 17, 18, 19, 20, 21, 22] steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - ref: ${{ github.head_ref }} + - name: Checkout code + uses: actions/checkout@v2 + with: + ref: ${{ github.head_ref }} - - name: Merge Conflict finder - uses: olivernybroe/action-conflict-finder@v1.1 + - name: Merge Conflict finder + uses: olivernybroe/action-conflict-finder@v1.1 - - name: Use Java Version ${{ matrix.java }} - uses: actions/setup-java@v2 - with: - distribution: 'zulu' - java-version: ${{ matrix.java }} - cache: 'gradle' + - name: Use Java Version ${{ matrix.java }} + uses: actions/setup-java@v2 + with: + distribution: "zulu" + java-version: ${{ matrix.java }} + cache: "gradle" - - name: Install - run: gradle dependencies + - name: Install + run: gradle dependencies - - name: Test - run: gradle test && gradle jacocoTestReport + - name: Test + run: gradle test && gradle jacocoTestReport - - name: Codecov - run: bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }} + - name: Codecov + run: bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..1323e0dc --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "java.compile.nullAnalysis.mode": "automatic", + "java.configuration.updateBuildConfiguration": "automatic" +} diff --git a/build.gradle b/build.gradle index 0e176451..fac5a106 100644 --- a/build.gradle +++ b/build.gradle @@ -3,14 +3,18 @@ plugins { id 'maven-publish' id 'signing' id 'jacoco' - id 'com.diffplug.spotless' version '5.6.1' + id 'com.diffplug.spotless' version '6.25.0' } group = 'org.arkecosystem' version = '2.0.0' -sourceCompatibility = 1.8 -targetCompatibility = 1.8 +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + withJavadocJar() + withSourcesJar() +} repositories { mavenLocal() @@ -18,21 +22,17 @@ repositories { } dependencies { - implementation group: 'org.bitcoinj', name: 'bitcoinj-core', version: '0.15.8' - implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6' - implementation 'com.google.guava:guava:30.1.1-jre' - - testCompileOnly 'org.slf4j:slf4j-api:1.7.32' - testRuntimeOnly 'org.slf4j:slf4j-simple:1.7.32' - testImplementation 'org.hamcrest:hamcrest-library:2.2' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2' - testCompileOnly 'org.junit.jupiter:junit-jupiter-params:5.7.2' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2' -} - -java { - withJavadocJar() - withSourcesJar() + implementation 'org.bitcoinj:bitcoinj-core:0.16.3' + implementation 'com.google.code.gson:gson:2.11.0' + implementation 'com.google.guava:guava:30.2.0-jre' + + testImplementation 'org.slf4j:slf4j-api:2.0.13' + testRuntimeOnly 'org.slf4j:slf4j-simple:2.0.13' + testImplementation 'org.hamcrest:hamcrest-library:3.0' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.3' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.10.3' } test { @@ -51,25 +51,25 @@ jacocoTestReport { spotless { java { - target fileTree(projectDir) { - include 'src/main/**/*.java' - include 'src/test/**/*.java' - exclude '**/build/**' - } - googleJavaFormat('1.1').aosp() + target 'src/**/*.java' + googleJavaFormat('1.17.0').aosp() } } -task formatCode(dependsOn: ['spotlessApply']) +tasks.register('formatCode') { + dependsOn 'spotlessApply' +} -task fatJar(type: Jar) { - manifest.from jar.manifest +tasks.register('fatJar', Jar) { + manifest { + attributes 'Main-Class': 'com.example.Main' + } from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } { - exclude "META-INF/*.SF" - exclude "META-INF/*.DSA" - exclude "META-INF/*.RSA" + exclude 'META-INF/*.SF' + exclude 'META-INF/*.DSA' + exclude 'META-INF/*.RSA' } with jar } @@ -77,7 +77,7 @@ task fatJar(type: Jar) { build.dependsOn 'spotlessApply' wrapper { - gradleVersion = '7.2' + gradleVersion = '8.1.1' } publishing { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ffed3a25..19cfad96 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/org/arkecosystem/crypto/Schnorr.java b/src/main/java/org/arkecosystem/crypto/Schnorr.java index 688c33a9..2b91b775 100644 --- a/src/main/java/org/arkecosystem/crypto/Schnorr.java +++ b/src/main/java/org/arkecosystem/crypto/Schnorr.java @@ -35,8 +35,7 @@ public static BigInteger[] addPoint(BigInteger[] p1, BigInteger[] p2) { .mod(p); else lam = - (p2[1] - .subtract(p1[1]) + (p2[1].subtract(p1[1]) .multiply(p2[0].subtract(p1[0]).modPow(p.subtract(TWO), p))) .mod(p); diff --git a/src/test/java/org/arkecosystem/crypto/signature/FixtureSignVerificationTest.java b/src/test/java/org/arkecosystem/crypto/signature/FixtureSignVerificationTest.java index 1835f0bc..7d5099f8 100644 --- a/src/test/java/org/arkecosystem/crypto/signature/FixtureSignVerificationTest.java +++ b/src/test/java/org/arkecosystem/crypto/signature/FixtureSignVerificationTest.java @@ -27,36 +27,35 @@ public class FixtureSignVerificationTest { @ParameterizedTest @ValueSource( - strings = { - "transactions/v2-ecdsa/second-signature-registration", - "transactions/v2-ecdsa/transfer-with-vendor-field-secondSign", - "transactions/v2-ecdsa/transfer-secondSign", - "transactions/v2-ecdsa/transfer-sign", - "transactions/v2-ecdsa/multi-payment-secondSign", - "transactions/v2-ecdsa/delegate-resignation-secondSign", - "transactions/v2-ecdsa/htlc-claim-sign", - "transactions/v2-ecdsa/htlc-claim-secondSign", - "transactions/v2-ecdsa/htlc-lock-sign", - "transactions/v2-ecdsa/htlc-refund-secondSign", - "transactions/v2-ecdsa/delegate-registration-sign", - "transactions/v2-ecdsa/vote-sign", - "transactions/v2-ecdsa/multi-payment-sign", - "transactions/v2-ecdsa/multi-payment-with-vendor-field-sign", - "transactions/v2-ecdsa/delegate-registration-secondSign", - "transactions/v2-ecdsa/ipfs-secondSign", - "transactions/v2-ecdsa/htlc-lock-secondSign", - "transactions/v2-ecdsa/unvote-sign", - "transactions/v2-ecdsa/vote-secondSign", - "transactions/v2-ecdsa/delegate-resignation-sign", - "transactions/v2-ecdsa/htlc-lock-with-vendor-field-sign", - "transactions/v2-ecdsa/ipfs-sign", - "transactions/v2-ecdsa/htlc-lock-with-vendor-field-secondSign", - "transactions/v2-ecdsa/unvote-secondSign", - "transactions/v2-ecdsa/transfer-with-vendor-field-sign", - "transactions/v2-ecdsa/multi-payment-with-vendor-field-secondSign", - "transactions/v2-ecdsa/htlc-refund-sign", - } - ) + strings = { + "transactions/v2-ecdsa/second-signature-registration", + "transactions/v2-ecdsa/transfer-with-vendor-field-secondSign", + "transactions/v2-ecdsa/transfer-secondSign", + "transactions/v2-ecdsa/transfer-sign", + "transactions/v2-ecdsa/multi-payment-secondSign", + "transactions/v2-ecdsa/delegate-resignation-secondSign", + "transactions/v2-ecdsa/htlc-claim-sign", + "transactions/v2-ecdsa/htlc-claim-secondSign", + "transactions/v2-ecdsa/htlc-lock-sign", + "transactions/v2-ecdsa/htlc-refund-secondSign", + "transactions/v2-ecdsa/delegate-registration-sign", + "transactions/v2-ecdsa/vote-sign", + "transactions/v2-ecdsa/multi-payment-sign", + "transactions/v2-ecdsa/multi-payment-with-vendor-field-sign", + "transactions/v2-ecdsa/delegate-registration-secondSign", + "transactions/v2-ecdsa/ipfs-secondSign", + "transactions/v2-ecdsa/htlc-lock-secondSign", + "transactions/v2-ecdsa/unvote-sign", + "transactions/v2-ecdsa/vote-secondSign", + "transactions/v2-ecdsa/delegate-resignation-sign", + "transactions/v2-ecdsa/htlc-lock-with-vendor-field-sign", + "transactions/v2-ecdsa/ipfs-sign", + "transactions/v2-ecdsa/htlc-lock-with-vendor-field-secondSign", + "transactions/v2-ecdsa/unvote-secondSign", + "transactions/v2-ecdsa/transfer-with-vendor-field-sign", + "transactions/v2-ecdsa/multi-payment-with-vendor-field-secondSign", + "transactions/v2-ecdsa/htlc-refund-sign", + }) void checkEcdsa(String file) { LinkedTreeMap fixture = FixtureLoader.load(file); @@ -67,50 +66,49 @@ void checkEcdsa(String file) { @ParameterizedTest @ValueSource( - strings = { - "transactions/v2-schnorr/second-signature-registration", - "transactions/v2-schnorr/transfer-with-vendor-field-secondSign", - "transactions/v2-schnorr/transfer-secondSign", - "transactions/v2-schnorr/multi-signature-registration", - "transactions/v2-schnorr/transfer-sign", - "transactions/v2-schnorr/multi-payment-secondSign", - "transactions/v2-schnorr/delegate-resignation-secondSign", - "transactions/v2-schnorr/htlc-claim-sign", - "transactions/v2-schnorr/htlc-claim-secondSign", - "transactions/v2-schnorr/htlc-lock-sign", - "transactions/v2-schnorr/htlc-refund-secondSign", - "transactions/v2-schnorr/delegate-registration-sign", - "transactions/v2-schnorr/vote-sign", - "transactions/v2-schnorr/multi-payment-sign", - "transactions/v2-schnorr/multi-payment-with-vendor-field-sign", - "transactions/v2-schnorr/delegate-registration-secondSign", - "transactions/v2-schnorr/ipfs-secondSign", - "transactions/v2-schnorr/htlc-lock-secondSign", - "transactions/v2-schnorr/unvote-sign", - "transactions/v2-schnorr/vote-secondSign", - "transactions/v2-schnorr/delegate-resignation-sign", - "transactions/v2-schnorr/htlc-lock-with-vendor-field-sign", - "transactions/v2-schnorr/ipfs-sign", - "transactions/v2-schnorr/htlc-lock-with-vendor-field-secondSign", - "transactions/v2-schnorr/unvote-secondSign", - "transactions/v2-schnorr/transfer-with-vendor-field-sign", - "transactions/v2-schnorr/multi-payment-with-vendor-field-secondSign", - "transactions/v2-schnorr/htlc-refund-sign", - "transactions/v2-schnorr/htlc-lock-multiSign", - "transactions/v2-schnorr/htlc-claim-multiSign", - "transactions/v2-schnorr/htlc-refund-multiSign", - "transactions/v2-schnorr/ipfs-multiSign", - "transactions/v2-schnorr/htlc-lock-with-vendor-field-multiSign", - "transactions/v2-schnorr/vote-multiSign", - "transactions/v2-schnorr/multi-payment-multiSign", - "transactions/v2-schnorr/transfer-with-vendor-field-multiSign", - "transactions/v2-schnorr/unvote-multiSign", - "transactions/v2-schnorr/delegate-registration-multiSign", - "transactions/v2-schnorr/transfer-multiSign", - "transactions/v2-schnorr/multi-payment-with-vendor-field-multiSign", - "transactions/v2-schnorr/delegate-resignation-multiSign", - } - ) + strings = { + "transactions/v2-schnorr/second-signature-registration", + "transactions/v2-schnorr/transfer-with-vendor-field-secondSign", + "transactions/v2-schnorr/transfer-secondSign", + "transactions/v2-schnorr/multi-signature-registration", + "transactions/v2-schnorr/transfer-sign", + "transactions/v2-schnorr/multi-payment-secondSign", + "transactions/v2-schnorr/delegate-resignation-secondSign", + "transactions/v2-schnorr/htlc-claim-sign", + "transactions/v2-schnorr/htlc-claim-secondSign", + "transactions/v2-schnorr/htlc-lock-sign", + "transactions/v2-schnorr/htlc-refund-secondSign", + "transactions/v2-schnorr/delegate-registration-sign", + "transactions/v2-schnorr/vote-sign", + "transactions/v2-schnorr/multi-payment-sign", + "transactions/v2-schnorr/multi-payment-with-vendor-field-sign", + "transactions/v2-schnorr/delegate-registration-secondSign", + "transactions/v2-schnorr/ipfs-secondSign", + "transactions/v2-schnorr/htlc-lock-secondSign", + "transactions/v2-schnorr/unvote-sign", + "transactions/v2-schnorr/vote-secondSign", + "transactions/v2-schnorr/delegate-resignation-sign", + "transactions/v2-schnorr/htlc-lock-with-vendor-field-sign", + "transactions/v2-schnorr/ipfs-sign", + "transactions/v2-schnorr/htlc-lock-with-vendor-field-secondSign", + "transactions/v2-schnorr/unvote-secondSign", + "transactions/v2-schnorr/transfer-with-vendor-field-sign", + "transactions/v2-schnorr/multi-payment-with-vendor-field-secondSign", + "transactions/v2-schnorr/htlc-refund-sign", + "transactions/v2-schnorr/htlc-lock-multiSign", + "transactions/v2-schnorr/htlc-claim-multiSign", + "transactions/v2-schnorr/htlc-refund-multiSign", + "transactions/v2-schnorr/ipfs-multiSign", + "transactions/v2-schnorr/htlc-lock-with-vendor-field-multiSign", + "transactions/v2-schnorr/vote-multiSign", + "transactions/v2-schnorr/multi-payment-multiSign", + "transactions/v2-schnorr/transfer-with-vendor-field-multiSign", + "transactions/v2-schnorr/unvote-multiSign", + "transactions/v2-schnorr/delegate-registration-multiSign", + "transactions/v2-schnorr/transfer-multiSign", + "transactions/v2-schnorr/multi-payment-with-vendor-field-multiSign", + "transactions/v2-schnorr/delegate-resignation-multiSign", + }) void checkSchnorrSignature(String file) { LinkedTreeMap fixture = FixtureLoader.load(file); @@ -129,50 +127,49 @@ void checkSchnorrSignature(String file) { @ParameterizedTest @ValueSource( - strings = { - "transactions/v2-schnorr/second-signature-registration", - "transactions/v2-schnorr/transfer-with-vendor-field-secondSign", - "transactions/v2-schnorr/transfer-secondSign", - "transactions/v2-schnorr/multi-signature-registration", - "transactions/v2-schnorr/transfer-sign", - "transactions/v2-schnorr/multi-payment-secondSign", - "transactions/v2-schnorr/delegate-resignation-secondSign", - "transactions/v2-schnorr/htlc-claim-sign", - "transactions/v2-schnorr/htlc-claim-secondSign", - "transactions/v2-schnorr/htlc-lock-sign", - "transactions/v2-schnorr/htlc-refund-secondSign", - "transactions/v2-schnorr/delegate-registration-sign", - "transactions/v2-schnorr/vote-sign", - "transactions/v2-schnorr/multi-payment-sign", - "transactions/v2-schnorr/multi-payment-with-vendor-field-sign", - "transactions/v2-schnorr/delegate-registration-secondSign", - "transactions/v2-schnorr/ipfs-secondSign", - "transactions/v2-schnorr/htlc-lock-secondSign", - "transactions/v2-schnorr/unvote-sign", - "transactions/v2-schnorr/vote-secondSign", - "transactions/v2-schnorr/delegate-resignation-sign", - "transactions/v2-schnorr/htlc-lock-with-vendor-field-sign", - "transactions/v2-schnorr/ipfs-sign", - "transactions/v2-schnorr/htlc-lock-with-vendor-field-secondSign", - "transactions/v2-schnorr/unvote-secondSign", - "transactions/v2-schnorr/transfer-with-vendor-field-sign", - "transactions/v2-schnorr/multi-payment-with-vendor-field-secondSign", - "transactions/v2-schnorr/htlc-refund-sign", - "transactions/v2-schnorr/htlc-lock-multiSign", - "transactions/v2-schnorr/htlc-claim-multiSign", - "transactions/v2-schnorr/htlc-refund-multiSign", - "transactions/v2-schnorr/ipfs-multiSign", - "transactions/v2-schnorr/htlc-lock-with-vendor-field-multiSign", - "transactions/v2-schnorr/vote-multiSign", - "transactions/v2-schnorr/multi-payment-multiSign", - "transactions/v2-schnorr/transfer-with-vendor-field-multiSign", - "transactions/v2-schnorr/unvote-multiSign", - "transactions/v2-schnorr/delegate-registration-multiSign", - "transactions/v2-schnorr/transfer-multiSign", - "transactions/v2-schnorr/multi-payment-with-vendor-field-multiSign", - "transactions/v2-schnorr/delegate-resignation-multiSign", - } - ) + strings = { + "transactions/v2-schnorr/second-signature-registration", + "transactions/v2-schnorr/transfer-with-vendor-field-secondSign", + "transactions/v2-schnorr/transfer-secondSign", + "transactions/v2-schnorr/multi-signature-registration", + "transactions/v2-schnorr/transfer-sign", + "transactions/v2-schnorr/multi-payment-secondSign", + "transactions/v2-schnorr/delegate-resignation-secondSign", + "transactions/v2-schnorr/htlc-claim-sign", + "transactions/v2-schnorr/htlc-claim-secondSign", + "transactions/v2-schnorr/htlc-lock-sign", + "transactions/v2-schnorr/htlc-refund-secondSign", + "transactions/v2-schnorr/delegate-registration-sign", + "transactions/v2-schnorr/vote-sign", + "transactions/v2-schnorr/multi-payment-sign", + "transactions/v2-schnorr/multi-payment-with-vendor-field-sign", + "transactions/v2-schnorr/delegate-registration-secondSign", + "transactions/v2-schnorr/ipfs-secondSign", + "transactions/v2-schnorr/htlc-lock-secondSign", + "transactions/v2-schnorr/unvote-sign", + "transactions/v2-schnorr/vote-secondSign", + "transactions/v2-schnorr/delegate-resignation-sign", + "transactions/v2-schnorr/htlc-lock-with-vendor-field-sign", + "transactions/v2-schnorr/ipfs-sign", + "transactions/v2-schnorr/htlc-lock-with-vendor-field-secondSign", + "transactions/v2-schnorr/unvote-secondSign", + "transactions/v2-schnorr/transfer-with-vendor-field-sign", + "transactions/v2-schnorr/multi-payment-with-vendor-field-secondSign", + "transactions/v2-schnorr/htlc-refund-sign", + "transactions/v2-schnorr/htlc-lock-multiSign", + "transactions/v2-schnorr/htlc-claim-multiSign", + "transactions/v2-schnorr/htlc-refund-multiSign", + "transactions/v2-schnorr/ipfs-multiSign", + "transactions/v2-schnorr/htlc-lock-with-vendor-field-multiSign", + "transactions/v2-schnorr/vote-multiSign", + "transactions/v2-schnorr/multi-payment-multiSign", + "transactions/v2-schnorr/transfer-with-vendor-field-multiSign", + "transactions/v2-schnorr/unvote-multiSign", + "transactions/v2-schnorr/delegate-registration-multiSign", + "transactions/v2-schnorr/transfer-multiSign", + "transactions/v2-schnorr/multi-payment-with-vendor-field-multiSign", + "transactions/v2-schnorr/delegate-resignation-multiSign", + }) void checkSigningAgainProducesSameSignature(String file) { LinkedTreeMap fixture = FixtureLoader.load(file);