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

Merge develop back to master #1379

Merged
merged 47 commits into from
Dec 5, 2023
Merged
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
4f1a904
Add link to GitHub
dannywillems Aug 30, 2023
5e91825
This TODO is done
dannywillems Aug 30, 2023
99b35be
Add helpers for inferring feature flags
mrmr1993 Oct 9, 2023
33252de
Derive binding types for FeatureFlags
mrmr1993 Oct 9, 2023
488ad18
[#14070] Add a unit check for the table id zero value condition
volhovm Oct 2, 2023
74b5b0c
[#14070] Fix the table dummy rows bug
volhovm Oct 12, 2023
eaf3184
[#14097,#14070] Move lookup table consistency checks into LookupTable…
volhovm Oct 12, 2023
2cf2ea4
Cosmetics on the lookup RFC
volhovm Oct 21, 2023
c5d1459
Capitalize book summary titles
volhovm Oct 23, 2023
d71b06b
Add .ignore file to .gitignore
volhovm Oct 23, 2023
51e2672
Improve RFC3, fix rendering in kimchi/overview.md
volhovm Oct 23, 2023
f38a2c3
Cargo: use wasm-bindgen 0.2.87
rbonichon Oct 26, 2023
57a3d8b
Merge pull request #1302 from o1-labs/rb/wasm-bindgen-0.2.87
dannywillems Oct 26, 2023
ab79316
Merge pull request #1292 from o1-labs/volhovm/rfc3-cosmetics
dannywillems Oct 30, 2023
81f1296
Initially move sections around [MinaProtocol/mina#14442]
volhovm Oct 31, 2023
992448e
Bump up actions/@checkout to 4.1.1
dannywillems Nov 1, 2023
b66e145
Merge pull request #1316 from o1-labs/dw/update-actions-to-4.1.1-develop
dannywillems Nov 1, 2023
251ab0c
[#14097,#14070] Enforce using constructor through private fields
volhovm Oct 16, 2023
cb46062
Formatting
volhovm Oct 16, 2023
e3aceaf
[#14097,#14070] Fix lookup test creating invalid id=0 zero table
volhovm Oct 16, 2023
1fac311
Add table id collision assertions to LookupConstraintSystem#create
volhovm Oct 24, 2023
d0e5de6
Improve lookup collision checks, fixed broken tests
volhovm Oct 30, 2023
64e9155
Add a test for lookup table id collisions
volhovm Oct 30, 2023
2121c7f
Address PR comments [MinaProtocol/mina#14070]
volhovm Nov 2, 2023
d79015d
Revert HashSet<LookupTable<_>> changes
volhovm Nov 2, 2023
2bcd3db
Consistency pass on book chapters / styling
volhovm Nov 2, 2023
73ae00a
Prettify sections more
volhovm Nov 7, 2023
ab36dce
Merge pull request #1275 from o1-labs/feature/infer-features-from-gates
dannywillems Nov 9, 2023
e9250aa
Merge branch 'develop' into misc/link-todo-with-gh-issues
dannywillems Nov 14, 2023
a285216
Add TODO link
dannywillems Nov 14, 2023
da65a25
Deduplicate lookup tables
mrmr1993 Nov 16, 2023
88c1776
Merge pull request #1334 from o1-labs/feature/deduplicate-lookup-table
dannywillems Nov 16, 2023
c8ebc93
Merge branch 'develop' into volhovm/mina14070-table-id-zero-row
volhovm Nov 16, 2023
7f6eba0
Merge pull request #1263 from o1-labs/volhovm/mina14070-table-id-zero…
dannywillems Nov 21, 2023
2f94807
Merge pull request #1304 from o1-labs/volhovm/mina14442-move-old-rfcs…
volhovm Nov 21, 2023
8920a01
Bare URL's are not supported and must be wrapped.
dannywillems Nov 27, 2023
25156a2
Update specifications
dannywillems Nov 27, 2023
901033a
Merge pull request #1200 from o1-labs/misc/link-todo-with-gh-issues
dannywillems Nov 28, 2023
6c6adca
Fix resolver warnings
dannywillems Nov 29, 2023
3908626
Merge pull request #1348 from o1-labs/dw/fix-resolver-warnings-develop
Nov 29, 2023
1c30635
Additional comment on the table_id_combiner
dannywillems Nov 29, 2023
bde1c05
Merge pull request #1355 from o1-labs/dw/additional-comments-on-combi…
dannywillems Nov 30, 2023
267105a
Revert "Merge pull request #1263 from o1-labs/volhovm/mina14070-table…
mrmr1993 Dec 4, 2023
5685f41
Merge pull request #1378 from o1-labs/feature/revert-bad-par
mrmr1993 Dec 4, 2023
862d172
Merge branch 'master' into merge-back-to-master
mrmr1993 Dec 4, 2023
9a999cf
Merge branch 'develop' into merge-back-to-master
mrmr1993 Dec 4, 2023
b88e61c
Reintroduce comment
mrmr1993 Dec 4, 2023
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
Prev Previous commit
Next Next commit
Add helpers for inferring feature flags
mrmr1993 committed Oct 9, 2023
commit 99b35be1af23f841ac433203148996463c59ebd3
67 changes: 43 additions & 24 deletions kimchi/src/circuits/constraints.rs
Original file line number Diff line number Diff line change
@@ -614,6 +614,47 @@ pub fn zk_rows_strict_lower_bound(num_chunks: usize) -> usize {
(2 * (PERMUTS + 1) * num_chunks - 2) / PERMUTS
}

impl FeatureFlags {
pub fn from_gates_and_lookup_features<F: PrimeField>(
gates: &[CircuitGate<F>],
lookup_features: LookupFeatures,
) -> FeatureFlags {
let mut feature_flags = FeatureFlags {
range_check0: false,
range_check1: false,
lookup_features,
foreign_field_add: false,
foreign_field_mul: false,
xor: false,
rot: false,
};

for gate in gates {
match gate.typ {
GateType::RangeCheck0 => feature_flags.range_check0 = true,
GateType::RangeCheck1 => feature_flags.range_check1 = true,
GateType::ForeignFieldAdd => feature_flags.foreign_field_add = true,
GateType::ForeignFieldMul => feature_flags.foreign_field_mul = true,
GateType::Xor16 => feature_flags.xor = true,
GateType::Rot64 => feature_flags.rot = true,
_ => (),
}
}

feature_flags
}

pub fn from_gates<F: PrimeField>(
gates: &[CircuitGate<F>],
uses_runtime_tables: bool,
) -> FeatureFlags {
FeatureFlags::from_gates_and_lookup_features(
gates,
LookupFeatures::from_gates(gates, uses_runtime_tables),
)
}
}

impl<F: PrimeField + SquareRootField> Builder<F> {
/// Set up the number of public inputs.
/// If not invoked, it equals `0` by default.
@@ -682,7 +723,7 @@ impl<F: PrimeField + SquareRootField> Builder<F> {
// for some reason we need more than 1 gate for the circuit to work, see TODO below
assert!(gates.len() > 1);

let lookup_features = LookupFeatures::from_gates(&gates, runtime_tables.is_some());
let feature_flags = FeatureFlags::from_gates(&gates, runtime_tables.is_some());

let lookup_domain_size = {
// First we sum over the lookup table size
@@ -705,7 +746,7 @@ impl<F: PrimeField + SquareRootField> Builder<F> {
}
}
// And we add the built-in tables, depending on the features.
let LookupFeatures { patterns, .. } = &lookup_features;
let LookupFeatures { patterns, .. } = &feature_flags.lookup_features;
for pattern in patterns.into_iter() {
if let Some(gate_table) = pattern.table() {
lookup_domain_size += gate_table.table_size();
@@ -782,28 +823,6 @@ impl<F: PrimeField + SquareRootField> Builder<F> {
.collect();
gates.append(&mut padding);

let mut feature_flags = FeatureFlags {
range_check0: false,
range_check1: false,
lookup_features,
foreign_field_add: false,
foreign_field_mul: false,
xor: false,
rot: false,
};

for gate in &gates {
match gate.typ {
GateType::RangeCheck0 => feature_flags.range_check0 = true,
GateType::RangeCheck1 => feature_flags.range_check1 = true,
GateType::ForeignFieldAdd => feature_flags.foreign_field_add = true,
GateType::ForeignFieldMul => feature_flags.foreign_field_mul = true,
GateType::Xor16 => feature_flags.xor = true,
GateType::Rot64 => feature_flags.rot = true,
_ => (),
}
}

//~ 1. sample the `PERMUTS` shifts.
let shifts = Shifts::new(&domain.d1);