Skip to content

Commit f3aba81

Browse files
Updated names
1 parent 71b60bd commit f3aba81

File tree

22 files changed

+60
-61
lines changed

22 files changed

+60
-61
lines changed

.github/workflows/primitives.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
paths:
99
- "crates/circuits/primitives/**"
1010
- "crates/circuits/poseidon2-air/**"
11-
- "crates/circuits/sha256-air/**"
11+
- "crates/circuits/sha-air/**"
1212

1313
concurrency:
1414
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
@@ -44,7 +44,7 @@ jobs:
4444
run: |
4545
cargo nextest run --cargo-profile fast --features parallel
4646
47-
- name: Run tests for sha256-air
48-
working-directory: crates/circuits/sha256-air
47+
- name: Run tests for sha-air
48+
working-directory: crates/circuits/sha-air
4949
run: |
5050
cargo nextest run --cargo-profile fast --features parallel

Cargo.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ openvm-sdk = { path = "crates/sdk", default-features = false }
112112
cargo-openvm = { path = "crates/cli", default-features = false }
113113
openvm-mod-circuit-builder = { path = "crates/circuits/mod-builder", default-features = false }
114114
openvm-poseidon2-air = { path = "crates/circuits/poseidon2-air", default-features = false }
115-
openvm-sha256-air = { path = "crates/circuits/sha256-air", default-features = false }
115+
openvm-sha-air = { path = "crates/circuits/sha-air", default-features = false }
116116
openvm-sha-macros = { path = "crates/circuits/sha-macros", default-features = false }
117117
openvm-circuit-primitives = { path = "crates/circuits/primitives", default-features = false }
118118
openvm-circuit-primitives-derive = { path = "crates/circuits/primitives/derive", default-features = false }

crates/circuits/sha256-air/Cargo.toml renamed to crates/circuits/sha-air/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "openvm-sha256-air"
2+
name = "openvm-sha-air"
33
version.workspace = true
44
authors.workspace = true
55
edition.workspace = true
File renamed without changes.

crates/circuits/sha256-air/src/columns.rs renamed to crates/circuits/sha-air/src/columns.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use openvm_stark_backend::p3_field::FieldAlgebra;
66

77
use crate::ShaConfig;
88

9-
/// In each SHA256 block:
10-
/// - First 16 rows use Sha256RoundCols
11-
/// - Final row uses Sha256DigestCols
9+
/// In each SHA block:
10+
/// - First C::ROUND_ROWS rows use ShaRoundCols
11+
/// - Final row uses ShaDigestCols
1212
///
13-
/// Sha256RoundCols and Sha256DigestCols share the same first 3 fields:
13+
/// ShaRoundCols and ShaDigestCols share the same first 3 fields:
1414
/// - flags
1515
/// - work_vars/hash (same type, different name)
1616
/// - schedule_helper

crates/circuits/sha256-air/src/config.rs renamed to crates/circuits/sha-air/src/config.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ pub trait ShaConfig: Send + Sync + Clone {
7979
};
8080
}
8181

82+
/// We can notice that `carry_a`'s and `carry_e`'s are always the same on invalid rows
83+
/// To optimize the trace generation of invalid rows, we precompute those values.
84+
/// This trait also stores the constants K and H for the given SHA config.
8285
pub trait ShaPrecomputedValues<T> {
8386
// these should be appropirately sized for the config
8487
fn get_invalid_carry_a(round_num: usize) -> &'static [u32];
@@ -109,8 +112,6 @@ impl ShaConfig for Sha256Config {
109112
const ROW_VAR_CNT: usize = 5;
110113
}
111114

112-
/// We can notice that `carry_a`'s and `carry_e`'s are always the same on invalid rows
113-
/// To optimize the trace generation of invalid rows, we have those values precomputed here
114115
pub const SHA256_INVALID_CARRY_A: [[u32; Sha256Config::WORD_U16S]; Sha256Config::ROUNDS_PER_ROW] = [
115116
[1230919683, 1162494304],
116117
[266373122, 1282901987],
@@ -177,8 +178,6 @@ impl ShaConfig for Sha512Config {
177178
const ROW_VAR_CNT: usize = 6;
178179
}
179180

180-
/// We can notice that `carry_a`'s and `carry_e`'s are always the same on invalid rows
181-
/// To optimize the trace generation of invalid rows, we have those values precomputed here
182181
pub(crate) const SHA512_INVALID_CARRY_A: [[u32; Sha512Config::WORD_U16S];
183182
Sha512Config::ROUNDS_PER_ROW] = [
184183
[55971842, 827997017, 993005918, 512731953],
@@ -306,7 +305,7 @@ impl ShaPrecomputedValues<u64> for Sha512Config {
306305
}
307306

308307
// Needed to avoid compile errors in utils.rs
309-
// don't ask me why this doesn't inf loop
308+
// not sure why this doesn't inf loop
310309
pub trait RotateRight {
311310
fn rotate_right(self, n: u32) -> Self;
312311
}

crates/circuits/sha256-air/src/lib.rs renamed to crates/circuits/sha-air/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Implementation of the SHA256 compression function without padding
1+
//! Implementation of the SHA256/SHA512 compression function without padding
22
//! This this AIR doesn't constrain any of the message padding
33
44
mod air;
File renamed without changes.

crates/circuits/sha256-air/src/trace.rs renamed to crates/circuits/sha-air/src/trace.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::{
1919
ShaRoundColsRef, WrappingAdd,
2020
};
2121

22-
/// The trace generation of SHA256 should be done in two passes.
22+
/// The trace generation of SHA should be done in two passes.
2323
/// The first pass should do `get_block_trace` for every block and generate the invalid rows through `get_default_row`
2424
/// The second pass should go through all the blocks and call `generate_missing_values`
2525
impl<C: ShaConfig + ShaPrecomputedValues<C::Word>> ShaAir<C> {
@@ -438,7 +438,7 @@ impl<C: ShaConfig + ShaPrecomputedValues<C::Word>> ShaAir<C> {
438438
/// This function should be called only after `generate_block_trace` was called for all blocks
439439
/// And [`Self::generate_default_row`] is called for all invalid rows
440440
/// Will populate the missing values of `trace`, where the width of the trace is `trace_width`
441-
/// and the starting column for the `Sha256Air` is `trace_start_col`.
441+
/// and the starting column for the `ShaAir` is `trace_start_col`.
442442
/// Note: `trace` needs to be the rows 1..C::ROWS_PER_BLOCK of a block and the first row of the next block
443443
pub fn generate_missing_cells<F: PrimeField32>(
444444
&self,
@@ -737,11 +737,8 @@ pub fn generate_trace<F: PrimeField32, C: ShaConfig + ShaPrecomputedValues<C::Wo
737737
debug_assert!(input.len() == C::BLOCK_U8S);
738738
}
739739

740-
println!("records.len(): {}", records.len());
741740
let non_padded_height = records.len() * C::ROWS_PER_BLOCK;
742-
println!("non_padded_height: {}", non_padded_height);
743741
let height = next_power_of_two_or_zero(non_padded_height);
744-
println!("height: {}", height);
745742
let width = <ShaAir<C> as BaseAir<F>>::width(sub_air);
746743
let mut values = F::zero_vec(height * width);
747744

0 commit comments

Comments
 (0)