-
Notifications
You must be signed in to change notification settings - Fork 270
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
feat: databus allows arbitrarily many reads per index #6524
Merged
Merged
Changes from 12 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
c5ee3f0
genericize ecc op wire and databus poly handling
ledwards2225 41e8aa2
add read tags but dont use them in relation yet
ledwards2225 a72a077
use read tags in relation
ledwards2225 3c80476
duplicate reads test passes
ledwards2225 179183e
duplicate reads stdlib test
ledwards2225 16551d8
cleanup
ledwards2225 fb11e48
Merge branch 'master' into lde/bus_reads
ledwards2225 ecf0b5c
Merge branch 'master' into lde/bus_reads
ledwards2225 cb4c8e0
Merge branch 'master' into lde/bus_reads
ledwards2225 1c7a95f
Merge branch 'master' into lde/bus_reads
ledwards2225 691922e
Merge branch 'master' into lde/bus_reads
ledwards2225 e09bd43
Merge branch 'master' into lde/bus_reads
ledwards2225 242c9e6
Merge branch 'master' into lde/bus_reads
ledwards2225 510bc94
Merge branch 'master' into lde/bus_reads
ledwards2225 4ae9944
Merge branch 'master' into lde/bus_reads
codygunton 91eeeef
Clarify test and fix typo
codygunton fcbd510
Merge branch 'master' into lde/bus_reads
codygunton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,3 +164,43 @@ TEST_F(DataBusTests, CallDataAndReturnData) | |
bool result = construct_and_verify_proof(builder); | ||
EXPECT_TRUE(result); | ||
} | ||
|
||
/** | ||
* @brief Test proof construction/verification for a circuit with duplicate calldata reads | ||
* | ||
*/ | ||
TEST_F(DataBusTests, CallDataDuplicateRead) | ||
{ | ||
// Construct a circuit and add some ecc op gates and arithmetic gates | ||
auto builder = construct_test_builder(); | ||
|
||
// Add some values to calldata | ||
std::vector<FF> calldata_values = { 7, 10, 3, 12, 1 }; | ||
for (auto& val : calldata_values) { | ||
builder.add_public_calldata(builder.add_variable(val)); | ||
} | ||
|
||
// Define some read indices with a duplicate | ||
std::vector<uint32_t> read_indices = { 1, 4, 1 }; | ||
|
||
// Create some calldata read gates and store the variable indices of the result for later | ||
std::vector<uint32_t> result_witness_indices; | ||
for (uint32_t& read_idx : read_indices) { | ||
// Create a variable corresponding to the index at which we want to read into calldata | ||
uint32_t read_idx_witness_idx = builder.add_variable(read_idx); | ||
|
||
auto value_witness_idx = builder.read_calldata(read_idx_witness_idx); | ||
result_witness_indices.emplace_back(value_witness_idx); | ||
} | ||
|
||
// Check that the read result is as axpected and that the duplicate reads produce the same result | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo: "expected" |
||
auto expected_read_result = calldata_values[1]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As an illustration of the functionality this could be a tad more explicit; will update. |
||
auto duplicate_read_result_1 = builder.get_variable(result_witness_indices[0]); | ||
auto duplicate_read_result_2 = builder.get_variable(result_witness_indices[2]); | ||
EXPECT_EQ(duplicate_read_result_1, expected_read_result); | ||
EXPECT_EQ(duplicate_read_result_1, duplicate_read_result_2); | ||
|
||
// Construct and verify Honk proof | ||
bool result = construct_and_verify_proof(builder); | ||
EXPECT_TRUE(result); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replacing a value that was boolean with the boolean
old value was at least 1
✅