hyperledger / besu-native

Apache License 2.0
13 stars 36 forks source link

Refactor/ipa multipoint interfaces #153

Closed thomas-quadratic closed 6 months ago

thomas-quadratic commented 7 months ago

This PR initialise a refactor of the JNI/FFI_interface to standardize the interfaces between Java and Rust.

Notably, we want to leverage only crypto-primitives related to vector commitments from rust-verkle. Any verkle logic is for besu-verkle-tries. Moreover, methods are composable since they follow a uniform format.

Here are the new features:

kevaundray commented 7 months ago

This PR takes code from ffi_interface meaning that this repo explicitly needs to know about ark-ed-on-bls12-381-bandersnatch and banderwagon -- I don't think this is the right abstraction to take, as it leaks details about the cryptography downstream. ffi_interface never exposes details about the underlying curve, banderwagon because this is just not important for downstream crates for example.

If there are changes that are needed for the cryptography interface, then ideally this is done in ffi_interface and not in besu_native, so besu_native only ever imports ffi_interface.

RE RLP -- I'll have to defer to @matkt or someone who knows more -- from looking at the rest of the packages, this doesn't seem like the right place to add RLP related code, perhaps besu-verkle-trie is where it should be?

matkt commented 7 months ago

This PR takes code from ffi_interface meaning that this repo explicitly needs to know about ark-ed-on-bls12-381-bandersnatch and banderwagon -- I don't think this is the right abstraction to take, as it leaks details about the cryptography downstream. ffi_interface never exposes details about the underlying curve, banderwagon because this is just not important for downstream crates for example.

If there are changes that are needed for the cryptography interface, then ideally this is done in ffi_interface and not in besu_native, so besu_native only ever imports ffi_interface.

RE RLP -- I'll have to defer to @matkt or someone who knows more -- from looking at the rest of the packages, this doesn't seem like the right place to add RLP related code, perhaps besu-verkle-trie is where it should be?

Indeed, having RLP here is a bit strange. However, I think it's necessary to consider the performance aspect to see if it allows for faster processing rather than having to do multiple JNI<>Java round-trips. Once we have the benchmarks, we can determine if it's worth exploring the RLP further or if we need to approach it differently.

thomas-quadratic commented 6 months ago

Deprecated.