Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

136 zkevm operations in bbf #145

Draft
wants to merge 64 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
33a540b
RW circuit implemented #95
ETatuzova Oct 24, 2024
05d7acc
L1 wrapper test fixed #95
ETatuzova Oct 24, 2024
e43cd85
Implemented all necessary changes, not tested
ayashunsky Oct 25, 2024
6b6df73
Bytecode updatec #95
ETatuzova Oct 25, 2024
72e4eeb
Merge branch '114-additional-bbf-constrain-processing-functions-for-z…
ETatuzova Oct 25, 2024
b7f8f21
Bytecode updated #95
ETatuzova Oct 25, 2024
220f91d
Fixes & dynamic selectors for lookups
ayashunsky Oct 26, 2024
5a43999
Merge branch '114-additional-bbf-constrain-processing-functions-for-z…
ETatuzova Oct 26, 2024
08ab7f8
#95 rw minor update
ETatuzova Oct 26, 2024
a3f921c
Implemented all necessary changes, not tested
ayashunsky Oct 25, 2024
ca3269e
Fixes & dynamic selectors for lookups
ayashunsky Oct 26, 2024
f4584f3
Rebase to master
ayashunsky Oct 27, 2024
0b47368
Merge with latest 114 branch #95
ETatuzova Oct 28, 2024
445c3dd
RW circuit optimizec #95
ETatuzova Oct 29, 2024
fcf2392
Input types defined #95
ETatuzova Oct 30, 2024
28d4775
Input types updated #95
ETatuzova Oct 31, 2024
2af82c5
zkEVM skeleton #95
ETatuzova Nov 1, 2024
3810fcc
Merge with master #95
ETatuzova Nov 1, 2024
c904c37
opcodes assignment added #95
ETatuzova Nov 1, 2024
c7aacb9
Opcode constraints initialization started #95
ETatuzova Nov 2, 2024
b6fdce8
First opcode constraint #95
ETatuzova Nov 2, 2024
947ce29
ISZERO implemented #95
ETatuzova Nov 2, 2024
9a74b8e
Merge branch 'master' of github.com:NilFoundation/placeholder into HEAD
ETatuzova Nov 2, 2024
5d4d5ff
PUSHx implemented #95
ETatuzova Nov 3, 2024
498823f
Opcode length controller constraint added#95
ETatuzova Nov 4, 2024
4bc3e45
PUSHx SWAPx DUPx JUMP JUMPI JUMPDEST #95
ETatuzova Nov 4, 2024
93a85ee
New opcodes #95
ETatuzova Nov 5, 2024
b35dfc5
l1_wrapper removed to BBF #95
ETatuzova Nov 5, 2024
4271273
Minor fix #95
ETatuzova Nov 5, 2024
4eee515
New opcodes, reorder RW operations, RETURN copy event#95
ETatuzova Nov 7, 2024
41448b9
Merge branch 'master' of github.com:NilFoundation/placeholder into HEAD
ETatuzova Nov 7, 2024
5938964
addmod zkevm bbf
Nov 7, 2024
f3573a8
Larger test #95
ETatuzova Nov 8, 2024
7018df1
Specialized copy test #95
ETatuzova Nov 8, 2024
578312c
Specialized opcode testing environment #95
ETatuzova Nov 8, 2024
4505f99
Mod_ops test added, lookup constraints amount decreased #95
ETatuzova Nov 11, 2024
37e1989
ADDMOD testing #95
ETatuzova Nov 11, 2024
82df0cd
mulmod bbf initial commit
Nov 11, 2024
19914fe
Merge branch '95-rw-in-bbf' into 136-zkevm-operations-in-bbf
Nov 11, 2024
5e9b214
call_id initialization fixed #95
ETatuzova Nov 11, 2024
8b6d63e
Merge branch '95-rw-in-bbf' into 136-zkevm-operations-in-bbf
Nov 11, 2024
224c5fc
addmod constraints
Nov 12, 2024
3456f7c
Bitwise operations added #95
ETatuzova Nov 12, 2024
749f5b4
Merge branch 'master' of github.com:NilFoundation/placeholder into HEAD
ETatuzova Nov 12, 2024
8f8b038
ADDMOD support #95
ETatuzova Nov 12, 2024
3590ce0
Add hardhat test for modular operations. Fixed hardhat_input_generatr…
ETatuzova Nov 12, 2024
efa8552
Keccak test added, SCMP bug fixed #95
ETatuzova Nov 12, 2024
9f0a018
merge
Nov 12, 2024
1f30f1a
CMP tests added. SLOAD fixed, bitwise lookup constraints amount decre…
ETatuzova Nov 13, 2024
741bd0e
Merge branch 'master' of github.com:NilFoundation/placeholder into HEAD
ETatuzova Nov 13, 2024
d73fb5a
Mulmod from 126 branch pulled, but it doesn't work #95
ETatuzova Nov 13, 2024
b16fbdf
Pull MULMOD from 136 branch #95
ETatuzova Nov 14, 2024
596a547
Copy circuit constraints added #95
ETatuzova Nov 14, 2024
2aea4a0
mulmod constraints table
Nov 14, 2024
2d2a8ec
Keccak support added #95
ETatuzova Nov 14, 2024
992b095
Merge with master branch #95
ETatuzova Nov 15, 2024
d12eaed
shl zkevm bbf
Nov 15, 2024
c9cc1da
shr zkevm bbf initial commit
Nov 15, 2024
5eaad31
Merge branch '95-rw-in-bbf' into 136-zkevm-operations-in-bbf
Nov 18, 2024
09729f9
ADD and SUB implemented #95
ETatuzova Nov 18, 2024
e10107d
sar zkevm bbf
Nov 20, 2024
7c89dc3
Byte_ops test fixed #95
ETatuzova Nov 20, 2024
8d1cc0c
Merge branch '95-rw-in-bbf' into 136-zkevm-operations-in-bbf
Nov 20, 2024
6e69f7d
zkevm shifts operation bbf
Nov 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crypto3/libs/blueprint/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set_target_properties(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} PROPERTIES
EXPORT_NAME ${CURRENT_PROJECT_NAME})

target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../test_tools/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)

Expand Down
43 changes: 42 additions & 1 deletion crypto3/libs/blueprint/include/nil/blueprint/bbf/generic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ namespace nil {

void allocate(TYPE &C, size_t col, size_t row, column_type t) {
if (is_allocated(col, row, t)) {
BOOST_LOG_TRIVIAL(warning) << "RE-allocation of " << t << " cell at col = " << col << ", row = " << row << ".\n";
// BOOST_LOG_TRIVIAL(warning) << "RE-allocation of " << t << " cell at col = " << col << ", row = " << row << ".\n";
}
if (t == column_type::constant) {
auto [has_vars, min_row, max_row] = expression_row_range_visitor<var>::row_range(C);
Expand Down Expand Up @@ -413,6 +413,16 @@ namespace nil {
add_constraint(C_rel, get_row(row));
}

void relative_constrain(TYPE C_rel, std::size_t start_row, std::size_t end_row) {
if (!is_relative(C_rel)) {
std::stringstream ss;
ss << "Constraint " << C_rel << " has absolute variables, cannot constrain.";
throw std::logic_error(ss.str());
}
add_constraint(C_rel, get_row(start_row), get_row(end_row));
}


void lookup(std::vector<TYPE> &C, std::string table_name) {
std::set<std::size_t> base_rows = {};

Expand Down Expand Up @@ -470,6 +480,17 @@ namespace nil {
add_lookup_constraint(table_name, C, row);
}

void relative_lookup(std::vector<TYPE> &C, std::string table_name, std::size_t start_row, std::size_t end_row) {
for(const TYPE c_part : C) {
if (!is_relative(c_part)) {
std::stringstream ss;
ss << "Constraint " << c_part << " has absolute variables, cannot constrain.";
throw std::logic_error(ss.str());
}
}
add_lookup_constraint(table_name, C, start_row, end_row);
}

void lookup_table(std::string name, std::vector<std::size_t> W, std::size_t from_row, std::size_t num_rows) {
if (lookup_tables->find(name) != lookup_tables->end()) {
BOOST_LOG_TRIVIAL(error) << "Double declaration of dynamic lookup table '" << name << "'!\n";
Expand Down Expand Up @@ -600,6 +621,16 @@ namespace nil {
constraints->at(C_id).second.set_row(stored_row);
}

void add_constraint(TYPE &C_rel, std::size_t start_row, std::size_t end_row) {
std::size_t stored_start_row = start_row - (is_fresh ? row_shift : 0);
std::size_t stored_end_row = end_row - (is_fresh ? row_shift : 0);
constraint_id_type C_id = constraint_id_type(C_rel);
if (constraints->find(C_id) == constraints->end()) {
constraints->insert({C_id, {C_rel, row_selector<>(desc.rows_amount)}});
}
constraints->at(C_id).second.set_interval(stored_start_row, stored_end_row);
}

void add_lookup_constraint(
std::string table_name, const lookup_input_constraints_type &C_rel, std::size_t row) {
std::size_t stored_row = row - (is_fresh ? row_shift : 0);
Expand All @@ -614,6 +645,16 @@ namespace nil {
lookup_constraints->at(key).second.set_row(stored_row);
}

void add_lookup_constraint(std::string table_name, std::vector<TYPE> &C_rel, std::size_t start_row, std::size_t end_row) {
std::size_t stored_start_row = start_row - (is_fresh ? row_shift : 0);
std::size_t stored_end_row = end_row - (is_fresh ? row_shift : 0);
constraint_id_type C_id = constraint_id_type(C_rel);
if (lookup_constraints->find({table_name,C_id}) == lookup_constraints->end()) {
lookup_constraints->insert({{table_name,C_id}, {lookup_input_constraints_type(C_rel), row_selector<>(desc.rows_amount)}});
}
lookup_constraints->at({table_name,C_id}).second.set_interval(stored_start_row, stored_end_row);
}

void add_lookup_constraint(std::string table_name, std::vector<TYPE> &C_rel, std::size_t row) {
add_lookup_constraint(table_name, lookup_input_constraints_type(C_rel), row);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ namespace nil {
res = R;
};
};

} // namespace bbf
} // namespace blueprint
} // namespace nil
Expand Down
Loading
Loading