Skip to content

Commit

Permalink
Make _impl consistent.
Browse files Browse the repository at this point in the history
  • Loading branch information
HristoStaykov committed Mar 8, 2024
1 parent 23d0edf commit f8517ce
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <type_traits>

#include "json_serialization_utils.h"
#include "../../circuits_impl/verify_attestation_data_imp.h"
#include "../../circuits_impl/verify_attestation_data_impl.h"

template<>
nlohmann::json serialize(const CheckpointVariable& checkpoint) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "utils/file_utils.h"
#include "serialization/serialize_attestation.h"

#include "circuits_impl/verify_attestation_data_imp.h"
#include "circuits_impl/verify_attestation_data_impl.h"
#include "utils/attestation_utils.h"

using namespace circuit_byte_utils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "../circuits_impl/verify_attestation_data_imp.h"
#include "../circuits_impl/verify_attestation_data_impl.h"

[[circuit]] base_field_type verify_attestation_data(HashType block_root, Attestation attestation,
base_field_type sigma) {
auto result = verify_attestation_data_imp(block_root, attestation, sigma);
auto result = verify_attestation_data_impl(block_root, attestation, sigma);
return result.token;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../circuits_impl/weigh_justification_and_finalization.h"
#include "../circuits_impl/weigh_justification_and_finalization_impl.h"

using namespace weigh_justification_and_finalization_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,16 @@ static_vector<HashType> compute_zero_hashes(int length = 64) {
return xs;
}

Proof fill_zero_hashes(const Proof& xs, size_t length = 0) {
template<size_t N, bool FULL>
static_vector<HashType, N, FULL> fill_zero_hashes(const static_vector<HashType, N, FULL>& xs, size_t length = 0) {
ASSERT(length <= xs.capacity);
const auto zero_hashes = compute_zero_hashes();
#ifdef __ZKLLVM__
sha256_t empty_hash = {0};
#else
auto empty_hash = get_empty_byte_array<32>();
#endif
Proof witnesses = xs;
static_vector<HashType, N, FULL> witnesses = xs;
int additions_count = length - xs.size();

for (int i = 0; i < witnesses.size(); i++) {
Expand Down Expand Up @@ -171,14 +173,14 @@ HashType hash_validator(Bytes64 pubkey,
}

VoteToken
verify_attestation_data_imp(const HashType& block_root, const Attestation& attestation, base_field_type sigma) {
verify_attestation_data_impl(const HashType& block_root, const Attestation& attestation, base_field_type sigma) {
assert_true(sigma != 0);

ssz_verify_proof(block_root, attestation.state_root, fill_zero_hashes(Proof(attestation.state_root_proof)), 11, 3);
ssz_verify_proof(block_root, attestation.state_root, fill_zero_hashes(attestation.state_root_proof), 11, 3);

ssz_verify_proof(attestation.state_root,
attestation.validators_root,
fill_zero_hashes(Proof(attestation.validators_root_proof)),
fill_zero_hashes(attestation.validators_root_proof),
43,
5);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "json/json.hpp"
using namespace nlohmann;

#include "circuits_impl/verify_attestation_data_imp.h"
#include "circuits_impl/verify_attestation_data_impl.h"
#include "utils/attestation_utils.h"

using namespace nil::crypto3::algebra::curves;
Expand Down Expand Up @@ -319,7 +319,7 @@ int main(int argc, char* argv[]) {

verify_attestation(attestation, json_attestation);

auto vote = verify_attestation_data_imp(
auto vote = verify_attestation_data_impl(
hexToBytes<32>("d5c0418465ffab221522a6991c2d4c0041f1b8e91d01b1ea3f6b882369f689b7"), attestation, sigma);

tokens.push_back(std::move(vote));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <fstream>
#include <streambuf>

#include "circuits_impl/weigh_justification_and_finalization.h"
#include "circuits_impl/weigh_justification_and_finalization_impl.h"
#include "utils/byte_utils.h"
#include "utils/file_utils.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using namespace nlohmann;
#include "byte_utils.h"
using namespace byte_utils;

#include "circuits_impl/verify_attestation_data_imp.h"
#include "circuits_impl/verify_attestation_data_impl.h"

namespace attestation_utils {

Expand Down

0 comments on commit f8517ce

Please sign in to comment.