Skip to content

Commit 4633850

Browse files
authored
transcript refactor (#103)
* wip wip wip wip update fmt wip update CI ipdate simplify CI fix fix add arith reenable bench wip almost there clippy and fmt more fixes fmt wip fix neon Update rust-toolchain wip older nightly version fix bench module update CI (#102) * update CI * ipdate * simplify CI * fix * fix * add arith * reenable bench remove avx512 instructions from avx256 (#94) Signed-off-by: Tiancheng Xie <[email protected]> Co-authored-by: siq1 <[email protected]> Co-authored-by: Tiancheng Xie <[email protected]> transcript crate refactoring transcript * fmt fmt
1 parent db49092 commit 4633850

30 files changed

+231
-217
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ jobs:
8585
run: |
8686
python3 ./scripts/install.py
8787
cargo run --bin=dev-setup --release
88-
cargo run --release -- -t ${{ matrix.os == 'macos-latest' && 2 || 16 }} -f ${{ matrix.field }}
88+
cargo run --release -- -t ${{ matrix.os == 'macos-latest' && 2 || 16 }} -f ${{ matrix.field }}

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ arith = { path = "arith" }
99
gf2 = { path = "arith/gf2" }
1010
gf2_128 = { path = "arith/gf2_128" }
1111
mersenne31 = { path = "arith/mersenne31" }
12+
transcript = { path = "transcript" }
1213

1314
ark-std.workspace = true
1415
clap.workspace = true
@@ -55,8 +56,9 @@ members = [
5556
"arith/gf2_128",
5657
"arith/goldilocks",
5758
"arith/mersenne31",
58-
"bi-kzg"
59-
]
59+
"bi-kzg",
60+
"transcript"
61+
]
6062

6163
[workspace.dependencies]
6264
ark-std = "0.4"

src/circuit/expander_circuit.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
use arith::Field;
22
use ark_std::test_rng;
3+
use transcript::Transcript;
4+
use transcript::TranscriptInstance;
35

46
use crate::circuit::*;
5-
use crate::{GKRConfig, Transcript};
7+
use crate::GKRConfig;
68

79
#[derive(Debug, Clone, Default)]
810
pub struct StructureInfo {
@@ -177,11 +179,11 @@ impl<C: GKRConfig> Circuit<C> {
177179
self.rnd_coefs_identified = true;
178180
}
179181

180-
pub fn fill_rnd_coefs(&mut self, transcript: &mut Transcript<C::FiatShamirHashType>) {
182+
pub fn fill_rnd_coefs(&mut self, transcript: &mut TranscriptInstance<C::FiatShamirHashType>) {
181183
assert!(self.rnd_coefs_identified);
182184
for &rnd_coef_ptr in &self.rnd_coefs {
183185
unsafe {
184-
*rnd_coef_ptr = transcript.circuit_f::<C>();
186+
*rnd_coef_ptr = transcript.generate_challenge::<C::CircuitField>();
185187
}
186188
}
187189
}

src/config/gkr_config.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ mod gf2_ext_keccak;
44
mod gf2_ext_sha2;
55
mod m31_ext_keccak;
66
mod m31_ext_sha2;
7-
8-
use crate::FiatShamirHash;
97
use arith::{ExtensionField, Field, FieldSerde, SimdField};
8+
use transcript::FiatShamirHash;
109

1110
pub use bn254_keccak::BN254ConfigKeccak;
1211
pub use bn254_sha2::BN254ConfigSha2;

src/config/gkr_config/bn254_keccak.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use halo2curves::bn256::Fr;
2-
3-
use crate::Keccak256hasher;
2+
use transcript::Keccak256hasher;
43

54
use super::{FieldType, GKRConfig};
65

src/config/gkr_config/bn254_sha2.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use halo2curves::bn256::Fr;
2-
3-
use crate::SHA256hasher;
2+
use transcript::SHA256hasher;
43

54
use super::{FieldType, GKRConfig};
65

src/config/gkr_config/gf2_ext_keccak.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use arith::ExtensionField;
22
use gf2::{GF2x8, GF2};
33
use gf2_128::{GF2_128x8, GF2_128};
4-
5-
use crate::Keccak256hasher;
4+
use transcript::Keccak256hasher;
65

76
use super::{FieldType, GKRConfig};
87

src/config/gkr_config/gf2_ext_sha2.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use arith::ExtensionField;
22
use gf2::{GF2x8, GF2};
33
use gf2_128::{GF2_128x8, GF2_128};
4-
5-
use crate::SHA256hasher;
4+
use transcript::SHA256hasher;
65

76
use super::{FieldType, GKRConfig};
87

src/config/gkr_config/m31_ext_keccak.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use arith::ExtensionField;
22
use mersenne31::{M31Ext3, M31Ext3x16, M31x16, M31};
3-
4-
use crate::Keccak256hasher;
3+
use transcript::Keccak256hasher;
54

65
use super::{FieldType, GKRConfig};
76

src/config/gkr_config/m31_ext_sha2.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use arith::ExtensionField;
22
use mersenne31::{M31Ext3, M31Ext3x16, M31x16, M31};
3-
4-
use crate::SHA256hasher;
3+
use transcript::SHA256hasher;
54

65
use super::{FieldType, GKRConfig};
76

0 commit comments

Comments
 (0)