-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
44 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,28 @@ | ||
#pragma once | ||
#include <cstddef> | ||
#include "sha256.hpp" | ||
#include <intx/intx.hpp> | ||
|
||
namespace evmone::crypto | ||
{ | ||
bool kzg_verify_proof(const std::byte versioned_hash[32], const std::byte z[32], | ||
using intx::operator""_u256; | ||
|
||
/// Length (in bytes) of the versioned hash (based on SHA256). | ||
constexpr auto VERSIONED_HASH_SIZE = SHA256_HASH_SIZE; | ||
|
||
/// The KZG version number of the versioned hash. | ||
constexpr std::byte VERSIONED_HASH_VERSION_KZG{0x01}; | ||
|
||
/// An EIP-4844 parameter. | ||
constexpr auto FIELD_ELEMENTS_PER_BLOB = 4096_u256; | ||
|
||
/// Scalar field modulus of BLS12-381. | ||
constexpr auto BLS_MODULUS = | ||
52435875175126190479447740508185965837690552500527637822603658699938581184513_u256; | ||
|
||
/// Number of significant bits of the BLS_MODULUS. | ||
constexpr size_t BLS_MODULUS_BITS = 255; | ||
static_assert((BLS_MODULUS >> BLS_MODULUS_BITS) == 0); | ||
|
||
bool kzg_verify_proof(const std::byte versioned_hash[VERSIONED_HASH_SIZE], const std::byte z[32], | ||
const std::byte y[32], const std::byte commitment[48], const std::byte proof[48]) noexcept; | ||
} | ||
} // namespace evmone::crypto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters