Skip to content

Commit ca91999

Browse files
fix: bigint fix & naming typos (#139)
## What ❔ * Fix in bigint circuit. * All the auto-generated files (by running ./recreate_verifiers.sh) * json layout file that is result of test Also fixed naming typos. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 7e05fe2 commit ca91999

File tree

23 files changed

+88
-75
lines changed

23 files changed

+88
-75
lines changed

.github/workflows/update-verifiers.yml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,39 @@ name: Update verifiers
22

33
on:
44
pull_request:
5-
types: [ synchronize, opened ]
6-
75

86
permissions:
9-
contents: write
10-
packages: read
11-
actions: read
12-
pull-requests: write
7+
contents: read
138

149
jobs:
1510
update_verifiers:
16-
runs-on: [ matterlabs-ci-runner-highmem ]
11+
runs-on: matterlabs-ci-runner-highmem
12+
env:
13+
COMMIT_MESSAGE: "chore: auto-update verifier binaries"
1714
steps:
18-
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3
15+
- name: Get last commit message via GitHub API
16+
id: commit
17+
run: |
18+
COMMIT_SHA="${{ github.event.pull_request.head.sha }}"
19+
MESSAGE=$(curl -s \
20+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
21+
https://api.github.com/repos/${{ github.repository }}/commits/${COMMIT_SHA} \
22+
| jq -r .commit.message)
23+
echo message="${MESSAGE}" >> "${GITHUB_OUTPUT}"
24+
25+
- name: Checkout repo
26+
if: ${{ !contains(steps.commit.outputs.message, env.COMMIT_MESSAGE) }}
27+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
28+
with:
29+
token: ${{ secrets.RELEASE_TOKEN }} # use PAT to trigger CI
1930

2031
- name: Build fresh verifiers
32+
if: ${{ !contains(steps.commit.outputs.message, env.COMMIT_MESSAGE) }}
2133
run: |
2234
tools/reproduce/reproduce.sh
2335
2436
- name: Fail if any files were modified
37+
if: ${{ !contains(steps.commit.outputs.message, env.COMMIT_MESSAGE) }}
2538
run: |
2639
git config user.name "github-actions[bot]"
2740
git config user.email "github-actions[bot]@users.noreply.github.com"
@@ -35,6 +48,6 @@ jobs:
3548
git fetch origin ${{ github.head_ref }}
3649
git checkout ${{ github.head_ref }}
3750
git stash pop || echo "Nothing to pop"
38-
git commit -a -m "chore: auto-update verifier binaries"
51+
git commit -a -m "${COMMIT_MESSAGE}"
3952
git push origin HEAD:${{ github.head_ref }}
40-
fi
53+
fi

blake2s_u32/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub const CONFIGURED_IV: [u32; 8] = const {
5252
result
5353
};
5454

55-
pub const EXNTENDED_CONFIGURED_IV: [u32; BLAKE2S_EXTENDED_STATE_WIDTH_IN_U32_WORDS] = const {
55+
pub const EXTENDED_CONFIGURED_IV: [u32; BLAKE2S_EXTENDED_STATE_WIDTH_IN_U32_WORDS] = const {
5656
let mut result = [0u32; BLAKE2S_EXTENDED_STATE_WIDTH_IN_U32_WORDS];
5757
let mut i = 0;
5858
while i < 8 {
@@ -76,7 +76,7 @@ pub use self::state_with_extended_control::Blake2RoundFunctionEvaluator as Deleg
7676

7777
pub mod state_with_extended_control_flags {
7878
use crate::BLAKE2S_BLOCK_SIZE_BYTES;
79-
use crate::EXNTENDED_CONFIGURED_IV;
79+
use crate::EXTENDED_CONFIGURED_IV;
8080

8181
pub const LAST_ROUND_BIT_IDX: usize = 0;
8282
pub const INPUT_IS_RIGHT_NODE_BIT_IDX: usize = 1;
@@ -87,7 +87,7 @@ pub mod state_with_extended_control_flags {
8787
pub const TEST_IF_COMPRESSION_MODE_MASK: u32 = 1 << COMPRESSION_MODE_BIT_IDX;
8888

8989
pub const COMPRESSION_MODE_EXTENDED_CONFIGURED_IV: [u32; 16] = const {
90-
let mut result = EXNTENDED_CONFIGURED_IV;
90+
let mut result = EXTENDED_CONFIGURED_IV;
9191
result[12] ^= BLAKE2S_BLOCK_SIZE_BYTES as u32;
9292
result[14] ^= 0xffffffff;
9393

blake2s_u32/src/vectorized_impls/arm_neon.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,25 +128,25 @@ impl State {
128128
use core::arch::aarch64::vld1q_u32;
129129

130130
Self([
131-
vld1q_u32(&EXNTENDED_CONFIGURED_IV[0] as *const u32),
132-
vld1q_u32(&EXNTENDED_CONFIGURED_IV[4] as *const u32),
133-
vld1q_u32(&EXNTENDED_CONFIGURED_IV[8] as *const u32),
134-
vld1q_u32(&EXNTENDED_CONFIGURED_IV[12] as *const u32),
131+
vld1q_u32(&EXTENDED_CONFIGURED_IV[0] as *const u32),
132+
vld1q_u32(&EXTENDED_CONFIGURED_IV[4] as *const u32),
133+
vld1q_u32(&EXTENDED_CONFIGURED_IV[8] as *const u32),
134+
vld1q_u32(&EXTENDED_CONFIGURED_IV[12] as *const u32),
135135
])
136136
}
137137

138138
#[inline(always)]
139139
unsafe fn partial_reset(&mut self) {
140140
use core::arch::aarch64::vld1q_u32;
141-
self.0[0] = vld1q_u32(&EXNTENDED_CONFIGURED_IV[0] as *const u32);
142-
self.0[1] = vld1q_u32(&EXNTENDED_CONFIGURED_IV[4] as *const u32);
141+
self.0[0] = vld1q_u32(&EXTENDED_CONFIGURED_IV[0] as *const u32);
142+
self.0[1] = vld1q_u32(&EXTENDED_CONFIGURED_IV[4] as *const u32);
143143
}
144144

145145
#[inline(always)]
146146
unsafe fn reset_for_round(&mut self, t: u32, is_last_round: bool) {
147147
use core::arch::aarch64::vld1q_u32;
148-
self.0[2] = vld1q_u32(&EXNTENDED_CONFIGURED_IV[8] as *const u32);
149-
let el = vld1q_u32(&EXNTENDED_CONFIGURED_IV[12] as *const u32);
148+
self.0[2] = vld1q_u32(&EXTENDED_CONFIGURED_IV[8] as *const u32);
149+
let el = vld1q_u32(&EXTENDED_CONFIGURED_IV[12] as *const u32);
150150
let xor_in = vld1q_u32(&[t, 0, (is_last_round as u32) * 0xffffffff, 0] as *const u32);
151151
use core::arch::aarch64::veorq_u32;
152152
let el = veorq_u32(el, xor_in);

circuit_defs/bigint_with_control/generated/circuit_layout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3247,7 +3247,7 @@ pub const VERIFIER_COMPILED_LAYOUT: VerifierCompiledCircuitArtifact<'static, Mer
32473247
ColumnAddress::MemorySubtree(62usize),
32483248
),
32493249
(
3250-
Mersenne31Field(2147483646u32),
3250+
Mersenne31Field(1u32),
32513251
ColumnAddress::WitnessSubtree(37usize),
32523252
ColumnAddress::WitnessSubtree(41usize),
32533253
),

circuit_defs/bigint_with_control/generated/layout

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5268,7 +5268,7 @@
52685268
}
52695269
],
52705270
[
5271-
2147483646,
5271+
1,
52725272
{
52735273
"WitnessSubtree": 37
52745274
},

circuit_defs/bigint_with_control/generated/quotient.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ unsafe fn evaluate_every_row_except_last(
11471147
let mut a = *(witness.get_unchecked(37usize));
11481148
let b = *(witness.get_unchecked(41usize));
11491149
a.mul_assign(&b);
1150-
individual_term.sub_assign(&a);
1150+
individual_term.add_assign(&a);
11511151
}
11521152
{
11531153
let mut a = *(witness.get_unchecked(37usize));

circuit_defs/bigint_with_control/verifier/src/generated/circuit_layout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3247,7 +3247,7 @@ pub const VERIFIER_COMPILED_LAYOUT: VerifierCompiledCircuitArtifact<'static, Mer
32473247
ColumnAddress::MemorySubtree(62usize),
32483248
),
32493249
(
3250-
Mersenne31Field(2147483646u32),
3250+
Mersenne31Field(1u32),
32513251
ColumnAddress::WitnessSubtree(37usize),
32523252
ColumnAddress::WitnessSubtree(41usize),
32533253
),

circuit_defs/bigint_with_control/verifier/src/generated/layout

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5268,7 +5268,7 @@
52685268
}
52695269
],
52705270
[
5271-
2147483646,
5271+
1,
52725272
{
52735273
"WitnessSubtree": 37
52745274
},

circuit_defs/bigint_with_control/verifier/src/generated/quotient.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ unsafe fn evaluate_every_row_except_last(
11471147
let mut a = *(witness.get_unchecked(37usize));
11481148
let b = *(witness.get_unchecked(41usize));
11491149
a.mul_assign(&b);
1150-
individual_term.sub_assign(&a);
1150+
individual_term.add_assign(&a);
11511151
}
11521152
{
11531153
let mut a = *(witness.get_unchecked(37usize));

cs/bigint_delegation_layout.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5268,7 +5268,7 @@
52685268
}
52695269
],
52705270
[
5271-
2147483646,
5271+
1,
52725272
{
52735273
"WitnessSubtree": 38
52745274
},

0 commit comments

Comments
 (0)