This repository has been archived by the owner on Jul 5, 2024. It is now read-only.
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.
Description
This PR is an attempt to address #1599. We add a debug log to see the read-write table counters in the constraints.
Unfortunately, the function is still quite limited. I would appreciate some advice on possible improvements.
Issue Link
#1599
Type of change
New feature (non-breaking change which adds functionality)
Contents
Rationale
As @DreamWuGit mentioned in #1599, we'd like to get some insights on what variables affect the read-write counts. An example is
10.expr() - is_first_tx.expr() + coinbase_code_hash_is_zero.expr()
. Using the automatic approach, we abstract away the manual count withcb.rw_counter_offset()
, but we also lost insight into the affecting variables.Unlike the bus-mapping RW counter, where we can print the proving time information, the circuit constraints encode possible computation paths in expressions. However, printing expressions is not a good way to solve the problem. Expressions look very messy in the debug message, and it's hard to gain insight from it because it shows only the cell position but not the variable's name.
We try to separate certain counts and uncertain counts. Expressions that don't depend on proving time conditions can be counted surely. Expressions that have conditions or varying reads writes are categorized in the special counts.
Some other quick problems I see.
true.expr()
orfalse.expr()
to give the is_write information, that information gets buried inExpression
.How Has This Been Tested?
Run any test with
RUST_LOG="RWC=debug"