From 3f9b7d7c5e54888352984e7da8df412176ebc224 Mon Sep 17 00:00:00 2001 From: siq1 Date: Tue, 27 Aug 2024 04:16:23 +0700 Subject: [PATCH] reenable some optimizations and adjust costs for keccak gf2 --- expander_compiler/src/builder/final_build_opt.rs | 4 ++-- expander_compiler/src/circuit/config.rs | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/expander_compiler/src/builder/final_build_opt.rs b/expander_compiler/src/builder/final_build_opt.rs index 9135831..65f80c1 100644 --- a/expander_compiler/src/builder/final_build_opt.rs +++ b/expander_compiler/src/builder/final_build_opt.rs @@ -458,8 +458,8 @@ impl Builder { + cost_of_possible_references::(&[0, 1, 0], ref_count.add, ref_count.mul); should_compress |= cost_compress < cost_no_compress; should_compress &= e.degree() > 0; - if should_compress && false { - // Currently, this don't consider the cost of relay, so it's disabled + if should_compress { + // Currently, this don't consider the cost of relay, so it's not good in some cases // TODO: fix this let es = self.to_single(e); self.in_var_exprs.push(es); diff --git a/expander_compiler/src/circuit/config.rs b/expander_compiler/src/circuit/config.rs index 83b9743..9875b86 100644 --- a/expander_compiler/src/circuit/config.rs +++ b/expander_compiler/src/circuit/config.rs @@ -42,5 +42,9 @@ impl Config for GF2Config { const CONFIG_ID: usize = 3; + // temporary fix for Keccak_GF2 + // TODO: measure actual costs + const COST_MUL: usize = 200; + const ENABLE_RANDOM_COMBINATION: bool = false; }