Skip to content

Commit ad8dda7

Browse files
committed
Merge branch 'master' into typo/fixes-v15
2 parents a295c85 + 6a0918d commit ad8dda7

File tree

46 files changed

+6823
-223
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+6823
-223
lines changed

.github/workflows/pr.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333

3434
test:
3535
needs: staticcheck
36-
runs-on: ubuntu-latest-128
36+
runs-on: gha-runner-scale-set-ubuntu-24-amd64-xxl
3737
permissions:
3838
pull-requests: write
3939
steps:
@@ -65,9 +65,9 @@ jobs:
6565
run: |
6666
set -euo pipefail
6767
go test -json -v -p 4 -short -timeout=30m ./... 2>&1 | gotestfmt -hide=all | tee /tmp/gotest.log
68-
go test -json -v -p 4 -tags=release_checks,solccheck . 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log
69-
go test -json -v -p 4 -tags=prover_checks ./test/... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log
70-
go test -json -v -p 4 -tags=prover_checks ./examples/... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log
68+
go test -json -v -p 4 -timeout=30m -tags=release_checks,solccheck . 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log
69+
go test -json -v -p 4 -timeout=30m -tags=prover_checks ./test/... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log
70+
go test -json -v -p 4 -timeout=30m -tags=prover_checks ./examples/... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log
7171
go test -json -v -run=NONE -fuzz=FuzzIntcomp -fuzztime=30s ./internal/backend/ioutils 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log
7272
7373

.github/workflows/push.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
strategy:
3939
matrix:
4040
go-version: [1.23.x]
41-
os: [ubuntu-latest-128, windows-latest, macos-latest]
41+
os: [gha-runner-scale-set-ubuntu-24-amd64-xxl, windows-latest, macos-latest]
4242
runs-on: ${{ matrix.os }}
4343
needs:
4444
- staticcheck
@@ -54,7 +54,7 @@ jobs:
5454
go install golang.org/x/tools/cmd/goimports@latest && go install github.com/klauspost/asmfmt/cmd/asmfmt@latest
5555
go install github.com/ethereum/go-ethereum/cmd/[email protected]
5656
- name: install solc deps
57-
if: startsWith(matrix.os, 'ubuntu') == true
57+
if: startsWith(matrix.os, 'gha-runner-scale-set-ubuntu') == true
5858
run: |
5959
go install github.com/consensys/[email protected]
6060
sudo add-apt-repository ppa:ethereum/ethereum
@@ -63,11 +63,11 @@ jobs:
6363
6464
- name: Test (windows / mac)
6565
# on macOS CI / Windows CI we avoid running the std/ tests (they are run on ubuntu CI)
66-
if: startsWith(matrix.os, 'ubuntu') == false
66+
if: startsWith(matrix.os, 'gha-runner-scale-set-ubuntu') == false
6767
run: |
6868
go test -tags=release_checks -v -timeout=60m .
6969
- name: Test (ubuntu - race and solc)
70-
if: startsWith(matrix.os, 'ubuntu') == true
70+
if: startsWith(matrix.os, 'gha-runner-scale-set-ubuntu') == true
7171
run: |
7272
go test -v -p 4 -short -timeout=30m ./...
7373
go test -v -p 4 -timeout=120m -tags=release_checks ./std/math/emulated/...

backend/plonk/bls12-377/prove.go

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

backend/plonk/bls12-381/prove.go

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

backend/plonk/bls24-315/prove.go

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

backend/plonk/bls24-317/prove.go

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

backend/plonk/bn254/prove.go

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

backend/plonk/bw6-633/prove.go

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

backend/plonk/bw6-761/prove.go

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

frontend/cs/r1cs/api.go

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,16 @@ func (builder *builder[E]) MulAcc(a, b, c frontend.Variable) frontend.Variable {
7777
// results fits, _a is mutated without performing a new memalloc
7878
builder.mbuf2 = builder.mbuf2[:0]
7979
builder.add([]expr.LinearExpression[E]{_a, builder.mbuf1}, false, 0, &builder.mbuf2)
80-
_a = _a[:0]
81-
if len(builder.mbuf2) <= cap(_a) {
80+
81+
// if we can add the multiplication term to the accumulator LE (by having sufficient capacity)
82+
// then we append directly into _a. However, _a can also be the hardcoded linear expressions corresponding
83+
// to zero or one constant. Now, we we would append into those then we would modify the underlying slice
84+
// thus modifying the constant themselves. This leads to undefined behaviour.
85+
//
86+
// So, in addition to only checking the capacity we also check that the underlying slices are different.
87+
// to avoid using unsafe.Pointer, we check the address of the first elements.
88+
if len(builder.mbuf2) <= cap(_a) && &(_a[0]) != &(builder.cstZero()[0]) && &(_a[0]) != &(builder.cstOne()[0]) {
89+
_a = _a[:0]
8290
// it fits, no mem alloc
8391
_a = append(_a, builder.mbuf2...)
8492
} else {
@@ -408,6 +416,31 @@ func (builder *builder[E]) Or(_a, _b frontend.Variable) frontend.Variable {
408416
builder.AssertIsBoolean(a)
409417
builder.AssertIsBoolean(b)
410418

419+
_aC, aConstant := builder.constantValue(a)
420+
_bC, bConstant := builder.constantValue(b)
421+
422+
if aConstant && bConstant {
423+
if builder.cs.IsOne(_aC) || builder.cs.IsOne(_bC) {
424+
return builder.cstOne()
425+
}
426+
return builder.cstZero()
427+
}
428+
429+
// if one input is constant, ensure we put it in b
430+
if aConstant {
431+
a, b = b, a
432+
_bC = _aC
433+
bConstant = aConstant
434+
}
435+
436+
if bConstant {
437+
if builder.cs.IsOne(_bC) {
438+
return builder.cstOne()
439+
} else {
440+
return a
441+
}
442+
}
443+
411444
// the formulation used is for easing up the conversion to sparse r1cs
412445
res := builder.newInternalVariable()
413446
builder.MarkBoolean(res)

0 commit comments

Comments
 (0)