Skip to content

Commit

Permalink
feat(proof-producer): enable exp traces after fix
Browse files Browse the repository at this point in the history
  • Loading branch information
x-mass committed Jan 20, 2025
1 parent 13ed7ff commit 3e188ae
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

#include <nil/blueprint/zkevm/zkevm_word.hpp>
#include <nil/blueprint/zkevm_bbf/types/opcode.hpp>
#include <nil/blueprint/zkevm_bbf/opcodes/dummy.hpp>

namespace nil {
namespace blueprint {
namespace bbf{

template<typename FieldType>
using zkevm_logx_operation = zkevm_dummy_operation<FieldType>;
} // namespace bbf
} // namespace blueprint
} // namespace nil
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
#include <nil/blueprint/zkevm_bbf/opcodes/call.hpp>
#include <nil/blueprint/zkevm_bbf/opcodes/staticcall.hpp>
#include <nil/blueprint/zkevm_bbf/opcodes/gas.hpp>
#include "nil/blueprint/zkevm_bbf/opcodes/logx.hpp"

namespace nil {
namespace blueprint {
Expand Down Expand Up @@ -733,6 +734,13 @@ namespace nil {
opcodes[zkevm_opcode::SWAP15] = std::make_shared<zkevm_swapx_operation<BlueprintFieldType>>(15);
opcodes[zkevm_opcode::SWAP16] = std::make_shared<zkevm_swapx_operation<BlueprintFieldType>>(16);

// // LOG
opcodes[zkevm_opcode::LOG0] = std::make_shared<zkevm_logx_operation<BlueprintFieldType>>();
opcodes[zkevm_opcode::LOG1] = std::make_shared<zkevm_logx_operation<BlueprintFieldType>>();
opcodes[zkevm_opcode::LOG2] = std::make_shared<zkevm_logx_operation<BlueprintFieldType>>();
opcodes[zkevm_opcode::LOG3] = std::make_shared<zkevm_logx_operation<BlueprintFieldType>>();
opcodes[zkevm_opcode::LOG4] = std::make_shared<zkevm_logx_operation<BlueprintFieldType>>();

// // fake opcodes for errors and padding
opcodes[zkevm_opcode::err0] = std::make_shared<zkevm_err0_operation<BlueprintFieldType>>();
opcodes[zkevm_opcode::err1] = std::make_shared<zkevm_err1_operation<BlueprintFieldType>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,6 @@ namespace nil {
std::vector<exp_input> exps;
exps.reserve(pb_traces->exp_ops_size());
for (const auto& pb_exp_op : pb_traces->exp_ops()) {
BOOST_LOG_TRIVIAL(trace) << "base: " << proto_uint256_to_zkevm_word(pb_exp_op.base()) << " , exponent: " << proto_uint256_to_zkevm_word(pb_exp_op.exponent()) << std::endl;
exps.emplace_back(
proto_uint256_to_zkevm_word(pb_exp_op.base()),
proto_uint256_to_zkevm_word(pb_exp_op.exponent())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,12 @@ 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) {
// return "can't read exp operations from file: " + exp_trace_path.string();
// }
// input.exponentiations = std::move(exp_operations->value);
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) {
return "can't read exp operations from file: " + exp_trace_path.string();
}
input.exponentiations = std::move(exp_operations->value);

ComponentType instance(
context_object,
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ INSTANTIATE_TEST_SUITE_P(MultiTxBytecode, ProverTests, :: testing::Values(Input{
INSTANTIATE_TEST_SUITE_P(MultiTxCopy, ProverTests, ::testing::Values(Input{MultiTxIncrement, COPY}));
INSTANTIATE_TEST_SUITE_P(MultiTxZkevm, ProverTests, ::testing::Values(Input{MultiTxIncrement, ZKEVM}));

// Single call of exp operation
const std::string SimpleExp = "exp/exp";
INSTANTIATE_TEST_SUITE_P(SimpleExpRw, ProverTests, ::testing::Values(Input{SimpleExp, RW}));
INSTANTIATE_TEST_SUITE_P(SimpleExpBytecode, ProverTests, :: testing::Values(Input{SimpleExp, BYTECODE}));
INSTANTIATE_TEST_SUITE_P(SimpleExpCopy, ProverTests, ::testing::Values(Input{SimpleExp, COPY}));
INSTANTIATE_TEST_SUITE_P(SimpleExpZkevm, ProverTests, ::testing::Values(Input{SimpleExp, ZKEVM}));

// RW trace is picked from another trace set and has different trace_idx
TEST(ProverTest, TraceIndexMismatch) {
const std::string trace_base_path = std::string(TEST_DATA_DIR) + "/broken_index/increment_simple.pb";
Expand Down

0 comments on commit 3e188ae

Please sign in to comment.