Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

precompiles: Use evmone::crypto::kzg_verify_proof instead of silkworm::verify_kzg_proof #2379

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
277 changes: 0 additions & 277 deletions silkworm/core/crypto/kzg.cpp

This file was deleted.

49 changes: 0 additions & 49 deletions silkworm/core/crypto/kzg.hpp

This file was deleted.

13 changes: 7 additions & 6 deletions silkworm/core/execution/precompile.cpp
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@
#include <limits>

#include <evmone_precompiles/blake2b.hpp>
#include <evmone_precompiles/kzg.hpp>
#include <evmone_precompiles/ripemd160.hpp>
#include <evmone_precompiles/sha256.hpp>

@@ -39,7 +40,6 @@

#include <silkworm/core/common/endian.hpp>
#include <silkworm/core/crypto/ecdsa.h>
#include <silkworm/core/crypto/kzg.hpp>
#include <silkworm/core/crypto/secp256k1n.hpp>
#include <silkworm/core/protocol/intrinsic_gas.hpp>
#include <silkworm/core/types/hash.hpp>
@@ -510,11 +510,12 @@ std::optional<Bytes> point_evaluation_run(ByteView input) noexcept {
std::span<const uint8_t, 48> commitment{&input[96], 48};
std::span<const uint8_t, 48> proof{&input[144], 48};

if (kzg_to_versioned_hash(commitment) != ByteView{versioned_hash}) {
return std::nullopt;
}

if (!verify_kzg_proof(commitment, z, y, proof)) {
if (!evmone::crypto::kzg_verify_proof(
std::as_bytes(versioned_hash).data(),
std::as_bytes(z).data(),
std::as_bytes(y).data(),
std::as_bytes(commitment).data(),
std::as_bytes(proof).data())) {
return std::nullopt;
}

3 changes: 2 additions & 1 deletion third_party/evmone/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -48,12 +48,13 @@ add_library(
evmone/lib/evmone_precompiles/blake2b.cpp
evmone/lib/evmone_precompiles/ripemd160.cpp
evmone/lib/evmone_precompiles/sha256.cpp
evmone/lib/evmone_precompiles/kzg.cpp
)
set_source_files_properties(evmone/lib/evmone/vm.cpp PROPERTIES COMPILE_DEFINITIONS PROJECT_VERSION="0.12.0")
target_include_directories(evmone PUBLIC evmone/include evmone/lib)
target_link_libraries(
evmone
PUBLIC evmc intx::intx
PUBLIC evmc intx::intx blst::blst
PRIVATE ethash::keccak
)