Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adjust to PR comments
Browse files Browse the repository at this point in the history
x-mass committed Jan 8, 2025

Verified

This commit was signed with the committer’s verified signature.
brucebolt Bruce Bolt
1 parent 93f79a7 commit 6dd36ac
Showing 4 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -14,14 +14,15 @@
namespace nil {
namespace proof_generator {

template<typename BlueprintFieldType>
using AssignmentTableFiller = std::function<std::optional<std::string>(
crypto3::zk::snark::plonk_assignment_table<nil::crypto3::algebra::fields::pallas_fq>& assignment_table,
crypto3::zk::snark::plonk_assignment_table<BlueprintFieldType>& assignment_table,
const boost::filesystem::path& trace_base_path,
const AssignerOptions& options)
>;

template<typename BlueprintFieldType>
std::map<const std::string, AssignmentTableFiller> circuit_selector = {
std::map<const std::string, AssignmentTableFiller<BlueprintFieldType>> circuit_selector = {
{circuits::BYTECODE, fill_bytecode_assignment_table<BlueprintFieldType>},
{circuits::RW, fill_rw_assignment_table<BlueprintFieldType>},
{circuits::ZKEVM, fill_zkevm_assignment_table<BlueprintFieldType>},
Original file line number Diff line number Diff line change
@@ -19,8 +19,6 @@ namespace nil {
std::optional<std::string> fill_bytecode_assignment_table(nil::crypto3::zk::snark::plonk_assignment_table<BlueprintFieldType>& assignment_table,
const boost::filesystem::path& trace_base_path,
const AssignerOptions& options) {
// TODO: print full name here, not only base
BOOST_LOG_TRIVIAL(debug) << "fill bytecode table from " << trace_base_path << "\n";

using ComponentType = nil::blueprint::bbf::bytecode<BlueprintFieldType, nil::blueprint::bbf::GenerationStage::ASSIGNMENT>;

@@ -30,6 +28,7 @@ namespace nil {
input.rlc_challenge = limits::RLC_CHALLENGE;

const auto bytecode_trace_path = get_bytecode_trace_path(trace_base_path);
BOOST_LOG_TRIVIAL(debug) << "fill bytecode table from " << bytecode_trace_path << "\n";
const auto contract_bytecodes = deserialize_bytecodes_from_file(bytecode_trace_path, options);
if (!contract_bytecodes) {
return "can't read bytecode trace from file: " + bytecode_trace_path.string();
Original file line number Diff line number Diff line change
@@ -143,10 +143,6 @@ namespace nil {
return res;
}

[[nodiscard]] std::string get_trace_extension(const boost::filesystem::path& trace_path) {
return trace_path.extension().string();
}

using TraceIndex = uint64_t; // value expected to be the same for all traces from the same set
using TraceIndexOpt = std::optional<TraceIndex>;

@@ -160,7 +156,6 @@ namespace nil {
return true;
}


template <typename TraceType>
struct DeserializeResult {
TraceType value;
@@ -197,7 +192,7 @@ namespace nil {
}

return DeserializeResult<BytecodeTraces>{
std::move(contract_bytecodes),
std::move(contract_bytecodes),
pb_traces->trace_idx()
};
}
@@ -265,7 +260,7 @@ namespace nil {
<< "storage " << pb_traces->storage_ops_size() << "\n";

return DeserializeResult<RWTraces>{
std::move(rw_traces),
std::move(rw_traces),
pb_traces->trace_idx()
};
}
@@ -314,7 +309,7 @@ namespace nil {
}

return DeserializeResult<ZKEVMTraces>{
std::move(zkevm_states),
std::move(zkevm_states),
pb_traces->trace_idx()
};
}
@@ -363,7 +358,7 @@ namespace nil {
}

return DeserializeResult<CopyEvents>{
std::move(copy_events),
std::move(copy_events),
pb_traces->trace_idx()
};
}
@@ -392,8 +387,8 @@ namespace nil {
}

return DeserializeResult<ExpTraces>{
std::move(exps),
pb_traces->trace_idx()
std::move(exps),
pb_traces->trace_idx()
};
}
} // namespace proof_generator
Original file line number Diff line number Diff line change
@@ -63,6 +63,7 @@ namespace nil {
}
input.copy_events = std::move(copy_events->value);

// TODO: fix assignment table filling
// const auto exp_trace_path = get_exp_trace_path(trace_base_path);
// const auto exp_operations = deserialize_exp_traces_from_file(exp_trace_path, options, contract_bytecodes->index);
// if (!exp_operations) {

0 comments on commit 6dd36ac

Please sign in to comment.