Skip to content

Commit

Permalink
switch from besu native to java-verkle-cryptography
Browse files Browse the repository at this point in the history
Signed-off-by: Karim Taam <[email protected]>
  • Loading branch information
matkt committed Oct 16, 2024
1 parent 7fa75d7 commit 1b27bf8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 36 deletions.
15 changes: 8 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,23 @@ sourceSets {
}

dependencies {
implementation "com.google.guava:guava"

implementation 'com.google.guava:guava'
implementation 'net.java.dev.jna:jna'
implementation 'io.github.crate-crypto:java-verkle-cryptography'
implementation 'io.tmio:tuweni-bytes'
implementation 'io.tmio:tuweni-units'
implementation 'io.tmio:tuweni-rlp'
implementation 'org.hyperledger.besu:ipa-multipoint'
implementation 'org.hyperledger.besu.internal:trie'
implementation 'org.hyperledger.besu.internal:rlp'
implementation 'io.tmio:tuweni-units'
implementation 'org.apache.logging.log4j:log4j-api'
implementation 'org.apache.logging.log4j:log4j-core'
implementation 'org.hyperledger.besu.internal:rlp'
implementation 'org.hyperledger.besu.internal:trie'

testImplementation 'org.junit.jupiter:junit-jupiter-api'
testImplementation 'org.junit.jupiter:junit-jupiter-params'
testImplementation 'com.fasterxml.jackson.core:jackson-databind'
testImplementation 'org.assertj:assertj-core'
testImplementation 'org.apache.commons:commons-csv:1.10.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testImplementation 'org.junit.jupiter:junit-jupiter-params'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ dependencyManagement {

dependency 'net.java.dev.jna:jna:5.14.0'

dependency 'org.hyperledger.besu:ipa-multipoint:0.8.5'

dependency 'org.assertj:assertj-core:3.25.1'

dependency 'io.github.crate-crypto:java-verkle-cryptography:0.0.2'

dependencySet(group: 'org.hyperledger.besu.internal', version: '24.7.0') {
entry 'rlp'
entry 'trie'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package org.hyperledger.besu.ethereum.trie.verkle.hasher;

import org.hyperledger.besu.nativelib.ipamultipoint.LibIpaMultipoint;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
Expand All @@ -28,6 +26,7 @@
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import org.apache.tuweni.bytes.MutableBytes;
import verkle.cryptography.LibIpaMultipoint;

/**
* A class responsible for hashing an array of Bytes32 using the pedersen commitment - multi scalar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@
*/
package org.hyperledger.besu.ethereum.trie.verkle.proof;

import org.hyperledger.besu.nativelib.ipamultipoint.LibIpaMultipoint;

import java.util.List;
import java.util.function.Function;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import verkle.cryptography.LibIpaMultipoint;

/**
* This class validates the Verkle proof against the specified pre-state root.
Expand All @@ -33,27 +30,6 @@
*/
public class ProofVerifier {

private static final Logger LOG = LogManager.getLogger(ProofVerifier.class);

static boolean nativeEnabled;

static {
maybeEnableNative();
}

public static void maybeEnableNative() {
try {
nativeEnabled = LibIpaMultipoint.ENABLED;
} catch (UnsatisfiedLinkError | NoClassDefFoundError ule) {
LOG.info("ipa multipoint native library not available: {}", ule.getMessage());
nativeEnabled = false;
}
}

public static boolean isNativeEnabled() {
return nativeEnabled;
}

public boolean verifyVerkleProof(
final List<Bytes> keys,
final List<Bytes> currentValues,
Expand Down

0 comments on commit 1b27bf8

Please sign in to comment.