Skip to content

Commit

Permalink
Smulator flavor; WIP blake3s; just use blake2s
Browse files Browse the repository at this point in the history
  • Loading branch information
codygunton committed Jul 14, 2023
1 parent 0fe1567 commit d720a1a
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cpp/src/barretenberg/plonk/flavor/flavor.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include "barretenberg/plonk/proof_system/proving_key/proving_key.hpp"
#include "barretenberg/proof_system/circuit_builder/circuit_simulator.hpp"
#include "barretenberg/proof_system/circuit_builder/standard_circuit_builder.hpp"
#include "barretenberg/proof_system/circuit_builder/turbo_circuit_builder.hpp"
#include "barretenberg/proof_system/circuit_builder/ultra_circuit_builder.hpp"
Expand Down Expand Up @@ -148,4 +149,14 @@ class Ultra {
return output;
}
};

class SimulatorBN254 {
public:
using CircuitBuilder = proof_system::CircuitSimulatorBN254;
static transcript::Manifest create_manifest(const size_t num_public_inputs)
{
return Ultra::create_manifest(num_public_inputs);
}
};

} // namespace proof_system::plonk::flavor
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#pragma once
#include "barretenberg/ecc/curves/bn254/fr.hpp"
#include "barretenberg/proof_system/arithmetization/gate_data.hpp"
#include "barretenberg/proof_system/plookup_tables/plookup_tables.hpp"
#include "barretenberg/proof_system/plookup_tables/types.hpp"
#include "barretenberg/proof_system/types/circuit_type.hpp"
#include "barretenberg/proof_system/types/merkle_hash_type.hpp"
#include "barretenberg/proof_system/types/pedersen_commitment_type.hpp"
#include <cstdint>

namespace proof_system {

Expand All @@ -17,6 +20,7 @@ class CircuitSimulatorBN254 {
bool contains_recursive_proof = false;
static constexpr size_t UINT_LOG2_BASE = 2; // WORKTODO: 6 for Ultra

static constexpr size_t num_gates = 0;
static constexpr uint32_t zero_idx = 0;

// uint32_t add_variable([[maybe_unused]]const FF& in){
Expand Down Expand Up @@ -65,6 +69,16 @@ class CircuitSimulatorBN254 {
void create_fixed_group_add_gate_with_init([[maybe_unused]] const fixed_group_add_quad& in,
[[maybe_unused]] const fixed_group_init_quad& init){};
void create_fixed_group_add_gate_final([[maybe_unused]] const add_quad& in){};
void create_ecc_add_gate([[maybe_unused]] const ecc_add_gate& in){};

plookup::ReadData<uint32_t> create_gates_from_plookup_accumulators(
[[maybe_unused]] const plookup::MultiTableId& id,
[[maybe_unused]] const plookup::ReadData<FF>& read_values,
[[maybe_unused]] const uint32_t key_a_index,
[[maybe_unused]] std::optional<uint32_t> key_b_index = std::nullopt)
{
return {};
};

accumulator_triple create_and_constraint([[maybe_unused]] const uint32_t a,
[[maybe_unused]] const uint32_t b,
Expand Down Expand Up @@ -101,6 +115,10 @@ class CircuitSimulatorBN254 {
return { 1028 };
};

void create_new_range_constraint([[maybe_unused]] const uint32_t variable_index,
[[maybe_unused]] const uint64_t target_range,
[[maybe_unused]] std::string const msg = "create_new_range_constraint"){};

void assert_equal(FF left, FF right, std::string const& msg)
{
if (left != right) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ field_t<C> pedersen_plookup_commitment<C>::compress(const std::vector<std::pair<
}

INSTANTIATE_STDLIB_ULTRA_TYPE(pedersen_plookup_commitment);
INSTANTIATE_STDLIB_SIMULATOR_TYPE(pedersen_plookup_commitment);

} // namespace stdlib
} // namespace proof_system::plonk
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ template <typename ComposerContext> class pedersen_plookup_commitment {
};

EXTERN_STDLIB_ULTRA_TYPE(pedersen_plookup_commitment)
EXTERN_STDLIB_SIMULATOR_TYPE(pedersen_plookup_commitment)
} // namespace stdlib
} // namespace proof_system::plonk
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ field_t<C> pedersen_plookup_hash<C>::hash_multiple(const std::vector<field_t>& i
}

INSTANTIATE_STDLIB_ULTRA_TYPE(pedersen_plookup_hash);
INSTANTIATE_STDLIB_SIMULATOR_TYPE(pedersen_plookup_hash);

} // namespace stdlib
} // namespace proof_system::plonk
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,7 @@ template <typename ComposerContext> class pedersen_plookup_hash {
};

EXTERN_STDLIB_ULTRA_TYPE(pedersen_plookup_hash);
EXTERN_STDLIB_SIMULATOR_TYPE(pedersen_plookup_hash);

} // namespace stdlib
} // namespace proof_system::plonk
1 change: 1 addition & 0 deletions cpp/src/barretenberg/stdlib/primitives/plookup/plookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,6 @@ field_t<Composer> plookup_read<Composer>::read_from_1_to_2_table(const MultiTabl
}

INSTANTIATE_STDLIB_ULTRA_TYPE(plookup_read)
INSTANTIATE_STDLIB_SIMULATOR_TYPE(plookup_read)
} // namespace stdlib
} // namespace proof_system::plonk
1 change: 1 addition & 0 deletions cpp/src/barretenberg/stdlib/primitives/plookup/plookup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ template <typename Composer> class plookup_read {
};

EXTERN_STDLIB_ULTRA_TYPE(plookup_read);
EXTERN_STDLIB_SIMULATOR_TYPE(plookup_read);

} // namespace stdlib
} // namespace proof_system::plonk

0 comments on commit d720a1a

Please sign in to comment.