This repository was archived by the owner on Jul 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 841
Use BinaryNumberChip in LexicographicOrderingConfig to lower degree #566
Merged
Merged
Changes from all commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
a7ecc3d
Add BinaryNumber chip
339eadc
Cleanup
67962c9
Use binary columns to select based on Tag
dc462db
Clean up and rename to_bits to as_bits
ddf7ea9
Add check that RwTableTag is in allowed range
92890a4
Fix degree test and remove unused function
c4ee256
Fix rebase and clean up invalid_values gate
9910424
Remove unused derive
941b394
Make requested changes
47c2e4a
clippy
2a7ca30
Make requested changes
81a1819
Create and use SortKeysConfig
7ac83e6
Cleanup lexicographic ordering config
f55976a
Fix rebase and limb count errors
e5bd60b
Fix first_access expression and remove unused IsZero gadget
bc80250
Clean up invalid values gate
725b53b
Replace is_id_uncchanged with binary expression
4bfcca7
cargo fix and fix tests
8f3fe8f
lower degree
65723be
clippy, fix, and fmt
2df49e7
clean up
9666e11
feat(evm-circuit): add dummy gadget (#563)
lispc 3938c61
Merge branch 'main' into fix/lex
ed91540
cleanup
9b2539b
update comments
1f50ebc
Use RLC to avoid overflow
faaa6eb
Add test
caf9ab0
cleanup
18d2bc0
clean up name
36632cd
Add todo
8575259
fix test
fb776f3
Add failing test
ed65af7
Add Rw::Padding
49b2dce
Add padding rows to state circuit to fix test
65db231
Fix degree test and add comment
5484006
Add rw_counter to Start for padding
78a89ee
Ignore start test for now
8567f73
Remove Rw::Padding
656b673
Fix test and cleanup
5afbdda
Add rw_counter constraint for Rw::Start and comment
3a33e74
Allow overrides in padding
04a1878
Update tests
b61f20d
Make state circuit generic over N_ROWS and fix constraint names
0a0a35e
Fix tests and build
80e2240
Merge branch 'main' into fix/padding
z2trillion e9b2a13
Merge branch 'main' into fix/lex
z2trillion d7912a8
Merge branch 'main' into fix/padding
z2trillion 199d764
Merge branch 'main' into fix/lex
DreamWuGit 0c7c615
Merge branch 'main' into fix/padding
z2trillion 71a985c
Merge branch 'main' into fix/lex
z2trillion a21884e
Update comments
9650097
Merge branch 'fix/padding' into fix/lex
60f1aaf
Merge branch 'main' into fix/lex
7da5f3f
fix merge
fd1bc76
Merge branch 'main' into fix/lex
z2trillion cdd2fd9
Merge branch 'main' into fix/lex
z2trillion 47e731f
Update comment and constraint names
d4c6156
Update zkevm-circuits/src/state_circuit/lexicographic_ordering.rs
z2trillion b948487
Update test to check that 5 bits is enough
0fbda89
update test for new constraint name
ea20e50
Update names and fmt
ef2c0fb
Update comments
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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ use super::{ | |
| use crate::evm_circuit::{ | ||
| param::N_BYTES_WORD, | ||
| table::{AccountFieldTag, RwTableTag}, | ||
| util::{not, or}, | ||
| util::not, | ||
| }; | ||
| use crate::util::Expr; | ||
| use eth_types::Field; | ||
|
|
@@ -23,15 +23,14 @@ pub struct Queries<F: Field> { | |
| pub tag: Expression<F>, | ||
| pub tag_bits: [Expression<F>; 4], | ||
| pub id: MpiQueries<F, N_LIMBS_ID>, | ||
| pub is_id_unchanged: Expression<F>, | ||
| pub is_tag_and_id_unchanged: Expression<F>, | ||
|
Collaborator
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. we also need
Contributor
Author
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. we can add them later when they're needed. |
||
| pub address: MpiQueries<F, N_LIMBS_ACCOUNT_ADDRESS>, | ||
| pub field_tag: Expression<F>, | ||
| pub storage_key: RlcQueries<F, N_BYTES_WORD>, | ||
| pub value: Expression<F>, | ||
| pub lookups: LookupsQueries<F>, | ||
| pub power_of_randomness: [Expression<F>; N_BYTES_WORD - 1], | ||
| pub is_storage_key_unchanged: Expression<F>, | ||
| pub lexicographic_ordering_upper_limb_difference_is_zero: Expression<F>, | ||
| pub first_access: Expression<F>, | ||
| } | ||
|
|
||
| type Constraint<F> = (&'static str, Expression<F>); | ||
|
|
@@ -144,9 +143,9 @@ impl<F: Field> ConstraintBuilder<F> { | |
| "stack address fits into 10 bits", | ||
| (q.address.value.clone(), q.lookups.u10.clone()), | ||
| ); | ||
| self.condition(q.is_id_unchanged.clone(), |cb| { | ||
| self.condition(q.is_tag_and_id_unchanged.clone(), |cb| { | ||
| cb.require_boolean( | ||
| "if call id is the same, address change is 0 or 1", | ||
| "if previous row is also Stack with unchanged call id, address change is 0 or 1", | ||
| q.address_change(), | ||
| ) | ||
| }); | ||
|
|
@@ -304,13 +303,7 @@ impl<F: Field> Queries<F> { | |
| } | ||
|
|
||
| fn first_access(&self) -> Expression<F> { | ||
| or::expr(&[ | ||
| not::expr( | ||
| self.lexicographic_ordering_upper_limb_difference_is_zero | ||
| .clone(), | ||
| ), | ||
| not::expr(self.is_storage_key_unchanged.clone()), | ||
| ]) | ||
| self.first_access.clone() | ||
| } | ||
|
|
||
| fn address_change(&self) -> Expression<F> { | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.