Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: non-native arithmetic autoreduction for division, inversion and sqrt #870

Merged
merged 4 commits into from
Nov 10, 2023

Conversation

ivokub
Copy link
Collaborator

@ivokub ivokub commented Oct 17, 2023

Description

Adds automatic modular reductions to division, inversion and square roots in field emulation when the intermediate results do not fit into the scalar field of the curve.

Fixes #867

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested?

  • Added regression test where the bug lead to arithmetic failure and is fixed with the fix.

How has this been benchmarked?

Not benchmarked.

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I did not modify files generated from templates
  • golangci-lint does not output errors locally
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@ivokub ivokub added the bug Something isn't working label Oct 17, 2023
@ivokub ivokub requested a review from gbotrel October 17, 2023 21:39
@ivokub ivokub self-assigned this Oct 17, 2023
@ivokub ivokub mentioned this pull request Oct 17, 2023
9 tasks
@github-actions
Copy link

📦 github.com/consensys/gnark/std/math/emulated
TestInverse 0s

TestInverse/Goldilocks/limb=64 0s

TestInverse/Goldilocks/limb=64/bn254 0s

panic: test timed out after 30m0s
running tests:
	TestInverse (30m0s)
	TestInverse/Goldilocks/limb=64 (30m0s)
	TestInverse/Goldilocks/limb=64/bn254 (30m0s)

goroutine 322 [running]:
testing.(*M).startAlarm.func1()
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:2259 +0x3b9
created by time.goFunc
	/opt/hostedtoolcache/go/1.21.1/x64/src/time/sleep.go:176 +0x2d

goroutine 1 [chan receive, 29 minutes]:
testing.(*T).Run(0xc000187860, {0xeae1e3?, 0x51fa1c?}, 0xf1aa90)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1649 +0x3c8
testing.runTests.func1(0x155dec0?)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:2054 +0x3e
testing.tRunner(0xc000187860, 0xc00023dc48)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1595 +0xff
testing.runTests(0xc00022d180?, {0x1554980, 0x1d, 0x1d}, {0x4182bf?, 0xc00023dd08?, 0x155c520?})
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:2052 +0x445
testing.(*M).Run(0xc00022d180)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1925 +0x636
main.main()
	_testmain.go:109 +0x19c

goroutine 306 [chan receive, 29 minutes]:
testing.(*T).Run(0xc000502ea0, {0xc0001d2a80?, 0xc000406ed0?}, 0xc0001928b0)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1649 +0x3c8
github.com/consensys/gnark/test.(*Assert).Run(0xc000406f18, 0xc000192890, {0xc000406f28?, 0x39?, 0x5ad?})
	/home/runner/work/gnark/gnark/test/assert.go:64 +0x99
github.com/consensys/gnark/std/math/emulated.testInverse[...](0xc000502ea0)
	/home/runner/work/gnark/gnark/std/math/emulated/element_test.go:403 +0x107
github.com/consensys/gnark/std/math/emulated.TestInverse(0x0?)
	/home/runner/work/gnark/gnark/std/math/emulated/element_test.go:392 +0x25
testing.tRunner(0xc000502ea0, 0xf1aa90)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 1
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1648 +0x3ad

goroutine 307 [chan receive, 29 minutes]:
testing.(*T).Run(0xc000186680, {0xc0001fc6b8?, 0xc000085ce0?}, 0xc000192d90)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1649 +0x3c8
github.com/consensys/gnark/test.(*Assert).Run(0xc000192ad0, 0xc000366120, {0xc000085e08?, 0x151332c?, 0x2?})
	/home/runner/work/gnark/gnark/test/assert.go:64 +0x99
github.com/consensys/gnark/test.(*Assert).CheckCircuit(0xc000356660?, {0x100a9e0?, 0xc000380000}, {0xc000085e88, 0x1, 0x1})
	/home/runner/work/gnark/gnark/test/assert_checkcircuit.go:39 +0x150
github.com/consensys/gnark/std/math/emulated.testInverse[...].func1()
	/home/runner/work/gnark/gnark/std/math/emulated/element_test.go:409 +0x2bd
github.com/consensys/gnark/test.(*Assert).Run.func1(0xc000186680)
	/home/runner/work/gnark/gnark/test/assert.go:66 +0xa7
testing.tRunner(0xc000186680, 0xc0001928b0)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 306
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1648 +0x3ad

goroutine 308 [runnable]:
internal/reflectlite.resolveNameOff(0xdd03e0?, 0x1193?)
	/opt/hostedtoolcache/go/1.21.1/x64/src/runtime/runtime1.go:625 +0x27
internal/reflectlite.rtype.nameOff(...)
	/opt/hostedtoolcache/go/1.21.1/x64/src/internal/reflectlite/type.go:244
internal/reflectlite.implements(0xdd03e0, 0xe46c40)
	/opt/hostedtoolcache/go/1.21.1/x64/src/internal/reflectlite/type.go:486 +0x3c8
internal/reflectlite.rtype.Implements({0xc000380230?}, {0x1016348, 0xdd03e0})
	/opt/hostedtoolcache/go/1.21.1/x64/src/internal/reflectlite/type.go:408 +0x65
errors.As({0x100a520, 0xc0004c75c0}, {0xdadaa0?, 0xc000366300})
	/opt/hostedtoolcache/go/1.21.1/x64/src/errors/wrap.go:106 +0x1dc
github.com/consensys/gnark/std/math/emulated.(*Field[...]).reduceAndOp(0x1020240?, 0xc0001d1b58, 0xc0001d1b40, 0xc000380230, 0x0)
	/home/runner/work/gnark/gnark/std/math/emulated/field_ops.go:402 +0xe6
github.com/consensys/gnark/std/math/emulated.(*Field[...]).Inverse(0x1018cd8?, 0xc0001a8380?)
	/home/runner/work/gnark/gnark/std/math/emulated/field_ops.go:44 +0x7b
github.com/consensys/gnark/std/math/emulated.(*InverseCircuit[...]).Define(0x100c9e0, {0x1018cd8, 0xc0001a8380?})
	/home/runner/work/gnark/gnark/std/math/emulated/element_test.go:386 +0x65
github.com/consensys/gnark/test.IsSolved({0x100a9e0, 0xc000380000}, {0x100a9e0, 0xc000380050}, 0xc000356980, {0x0, 0x0, 0x0?})
	/home/runner/work/gnark/gnark/test/engine.go:131 +0x445
github.com/consensys/gnark/test.(*Assert).CheckCircuit.func1(0x0?)
	/home/runner/work/gnark/gnark/test/assert_checkcircuit.go:49 +0x29b
github.com/consensys/gnark/test.(*Assert).Run.func1(0xc000186820)
	/home/runner/work/gnark/gnark/test/assert.go:66 +0xa7
testing.tRunner(0xc000186820, 0xc000192d90)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 307
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1648 +0x3ad

@github-actions
Copy link

📦 github.com/consensys/gnark/std/math/emulated
TestInverse 0s

TestInverse/Goldilocks/limb=64 0s

TestInverse/Goldilocks/limb=64/bn254 0s

panic: test timed out after 30m0s
running tests:
	TestInverse (30m0s)
	TestInverse/Goldilocks/limb=64 (30m0s)
	TestInverse/Goldilocks/limb=64/bn254 (30m0s)

goroutine 306 [running]:
testing.(*M).startAlarm.func1()
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:2259 +0x3b9
created by time.goFunc
	/opt/hostedtoolcache/go/1.21.1/x64/src/time/sleep.go:176 +0x2d

goroutine 1 [chan receive, 29 minutes]:
testing.(*T).Run(0xc0000d6ea0, {0xeae1e3?, 0x51fa1c?}, 0xf1aa90)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1649 +0x3c8
testing.runTests.func1(0x155dec0?)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:2054 +0x3e
testing.tRunner(0xc0000d6ea0, 0xc0001b5c48)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1595 +0xff
testing.runTests(0xc0001a5180?, {0x1554980, 0x1d, 0x1d}, {0x4182bf?, 0xc0001b5d08?, 0x155c520?})
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:2052 +0x445
testing.(*M).Run(0xc0001a5180)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1925 +0x636
main.main()
	_testmain.go:109 +0x19c

goroutine 221 [chan receive, 29 minutes]:
testing.(*T).Run(0xc0002a24e0, {0xc0000321e0?, 0xc00050aed0?}, 0xc000594110)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1649 +0x3c8
github.com/consensys/gnark/test.(*Assert).Run(0xc00050af18, 0xc000594100, {0xc00050af28?, 0x39?, 0x5ad?})
	/home/runner/work/gnark/gnark/test/assert.go:64 +0x99
github.com/consensys/gnark/std/math/emulated.testInverse[...](0xc0002a24e0)
	/home/runner/work/gnark/gnark/std/math/emulated/element_test.go:403 +0x107
github.com/consensys/gnark/std/math/emulated.TestInverse(0xc0004397c0?)
	/home/runner/work/gnark/gnark/std/math/emulated/element_test.go:392 +0x25
testing.tRunner(0xc0002a24e0, 0xf1aa90)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 1
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1648 +0x3ad

goroutine 222 [chan receive, 29 minutes]:
testing.(*T).Run(0xc0002a2820, {0xc000426658?, 0xc000124ce0?}, 0xc0005941b0)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1649 +0x3c8
github.com/consensys/gnark/test.(*Assert).Run(0xc000594170, 0xc0003ec120, {0xc000124e08?, 0x151332c?, 0x2?})
	/home/runner/work/gnark/gnark/test/assert.go:64 +0x99
github.com/consensys/gnark/test.(*Assert).CheckCircuit(0xc0001fe700?, {0x100a9e0?, 0xc000438000}, {0xc000124e88, 0x1, 0x1})
	/home/runner/work/gnark/gnark/test/assert_checkcircuit.go:39 +0x150
github.com/consensys/gnark/std/math/emulated.testInverse[...].func1()
	/home/runner/work/gnark/gnark/std/math/emulated/element_test.go:409 +0x2bd
github.com/consensys/gnark/test.(*Assert).Run.func1(0xc0002a2820)
	/home/runner/work/gnark/gnark/test/assert.go:66 +0xa7
testing.tRunner(0xc0002a2820, 0xc000594110)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 221
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1648 +0x3ad

goroutine 223 [runnable]:
github.com/consensys/gnark/test.(*engine).ConstantValue(0xc0001ac000, {0xea0440?, 0xc0001fe7a0?})
	/home/runner/work/gnark/gnark/test/engine.go:562 +0x48
github.com/consensys/gnark/std/math/emulated.(*Field[...]).constantValue(0x1020240, 0xc000438230)
	/home/runner/work/gnark/gnark/std/math/emulated/field.go:223 +0xa8
github.com/consensys/gnark/std/math/emulated.(*Field[...]).enforceWidthConditional(0x1020240, 0xc000438230)
	/home/runner/work/gnark/gnark/std/math/emulated/field.go:170 +0x3b
github.com/consensys/gnark/std/math/emulated.(*Field[...]).Reduce(0x1020240?, 0xc000438230)
	/home/runner/work/gnark/gnark/std/math/emulated/field_ops.go:253 +0x30
github.com/consensys/gnark/std/math/emulated.(*Field[...]).reduceAndOp(0x1020240?, 0xc0000d5b58, 0xc0000d5b40, 0xc000438230, 0x0)
	/home/runner/work/gnark/gnark/std/math/emulated/field_ops.go:404 +0x132
github.com/consensys/gnark/std/math/emulated.(*Field[...]).Inverse(0x1018cd8?, 0xc0001ac000?)
	/home/runner/work/gnark/gnark/std/math/emulated/field_ops.go:44 +0x7b
github.com/consensys/gnark/std/math/emulated.(*InverseCircuit[...]).Define(0x100c9e0, {0x1018cd8, 0xc0001ac000?})
	/home/runner/work/gnark/gnark/std/math/emulated/element_test.go:386 +0x65
github.com/consensys/gnark/test.IsSolved({0x100a9e0, 0xc000438000}, {0x100a9e0, 0xc000438050}, 0xc0001fea20, {0x0, 0x0, 0x0?})
	/home/runner/work/gnark/gnark/test/engine.go:131 +0x445
github.com/consensys/gnark/test.(*Assert).CheckCircuit.func1(0x0?)
	/home/runner/work/gnark/gnark/test/assert_checkcircuit.go:49 +0x29b
github.com/consensys/gnark/test.(*Assert).Run.func1(0xc0002a29c0)
	/home/runner/work/gnark/gnark/test/assert.go:66 +0xa7
testing.tRunner(0xc0002a29c0, 0xc0005941b0)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 222
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1648 +0x3ad

@ivokub
Copy link
Collaborator Author

ivokub commented Oct 17, 2023

@gbotrel - I cannot reproduce locally. It is timeouting, but I do not understand if only for a single test (TestInverse over Goldilocks) or for the whole suite. If only for a single test, then may be some infinite recursion (which doesn't happen locally), but makes sense for the whole suite as we have added emulated Groth16/KZG proofs etc.

@github-actions
Copy link

📦 github.com/consensys/gnark/std/math/emulated
TestInverse 0s

TestInverse/Goldilocks/limb=64 0s

TestInverse/Goldilocks/limb=64/bn254 0s

panic: test timed out after 30m0s
running tests:
	TestInverse (30m0s)
	TestInverse/Goldilocks/limb=64 (30m0s)
	TestInverse/Goldilocks/limb=64/bn254 (30m0s)

goroutine 205 [running]:
testing.(*M).startAlarm.func1()
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:2259 +0x3b9
created by time.goFunc
	/opt/hostedtoolcache/go/1.21.1/x64/src/time/sleep.go:176 +0x2d

goroutine 1 [chan receive, 29 minutes]:
testing.(*T).Run(0xc0001876c0, {0xeae1e3?, 0x51fa1c?}, 0xf1aa90)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1649 +0x3c8
testing.runTests.func1(0x155dec0?)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:2054 +0x3e
testing.tRunner(0xc0001876c0, 0xc00023bc48)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1595 +0xff
testing.runTests(0xc00022b180?, {0x1554980, 0x1d, 0x1d}, {0x4182bf?, 0xc00023bd08?, 0x155c520?})
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:2052 +0x445
testing.(*M).Run(0xc00022b180)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1925 +0x636
main.main()
	_testmain.go:109 +0x19c

goroutine 291 [chan receive, 29 minutes]:
testing.(*T).Run(0xc00032c340, {0xc0001d10e0?, 0xc0003cd6d0?}, 0xc000193f60)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1649 +0x3c8
github.com/consensys/gnark/test.(*Assert).Run(0xc0003cd718, 0xc000193f50, {0xc0003cd728?, 0x39?, 0x5ad?})
	/home/runner/work/gnark/gnark/test/assert.go:64 +0x99
github.com/consensys/gnark/std/math/emulated.testInverse[...](0xc00032c340)
	/home/runner/work/gnark/gnark/std/math/emulated/element_test.go:403 +0x107
github.com/consensys/gnark/std/math/emulated.TestInverse(0xc0003640f0?)
	/home/runner/work/gnark/gnark/std/math/emulated/element_test.go:392 +0x25
testing.tRunner(0xc00032c340, 0xf1aa90)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 1
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1648 +0x3ad

goroutine 292 [chan receive, 29 minutes]:
testing.(*T).Run(0xc00032c680, {0xc0003f0710?, 0xc000081ce0?}, 0xc000382000)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1649 +0x3c8
github.com/consensys/gnark/test.(*Assert).Run(0xc000193fc0, 0xc0000a8810, {0xc000081e08?, 0x151332c?, 0x2?})
	/home/runner/work/gnark/gnark/test/assert.go:64 +0x99
github.com/consensys/gnark/test.(*Assert).CheckCircuit(0xc0003fd020?, {0x100a9e0?, 0xc0003646e0}, {0xc000081e88, 0x1, 0x1})
	/home/runner/work/gnark/gnark/test/assert_checkcircuit.go:39 +0x150
github.com/consensys/gnark/std/math/emulated.testInverse[...].func1()
	/home/runner/work/gnark/gnark/std/math/emulated/element_test.go:409 +0x2bd
github.com/consensys/gnark/test.(*Assert).Run.func1(0xc00032c680)
	/home/runner/work/gnark/gnark/test/assert.go:66 +0xa7
testing.tRunner(0xc00032c680, 0xc000193f60)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 291
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1648 +0x3ad

goroutine 293 [runnable]:
internal/reflectlite.Value.Elem({0xdadaa0?, 0xc0000a89f0?, 0x16?})
	/opt/hostedtoolcache/go/1.21.1/x64/src/internal/reflectlite/value.go:226 +0x16f
errors.As({0x100a520, 0xc00034a060}, {0xdadaa0?, 0xc0000a89f0})
	/opt/hostedtoolcache/go/1.21.1/x64/src/errors/wrap.go:111 +0x36c
github.com/consensys/gnark/std/math/emulated.(*Field[...]).reduceAndOp(0x1020240?, 0xc0001cdb58, 0xc0001cdb40, 0xc000364910, 0x0)
	/home/runner/work/gnark/gnark/std/math/emulated/field_ops.go:402 +0xe6
github.com/consensys/gnark/std/math/emulated.(*Field[...]).Inverse(0x1018cd8?, 0xc000232690?)
	/home/runner/work/gnark/gnark/std/math/emulated/field_ops.go:44 +0x7b
github.com/consensys/gnark/std/math/emulated.(*InverseCircuit[...]).Define(0x100c9e0, {0x1018cd8, 0xc000232690?})
	/home/runner/work/gnark/gnark/std/math/emulated/element_test.go:386 +0x65
github.com/consensys/gnark/test.IsSolved({0x100a9e0, 0xc0003646e0}, {0x100a9e0, 0xc000364730}, 0xc0003fd340, {0x0, 0x0, 0x0?})
	/home/runner/work/gnark/gnark/test/engine.go:131 +0x445
github.com/consensys/gnark/test.(*Assert).CheckCircuit.func1(0x0?)
	/home/runner/work/gnark/gnark/test/assert_checkcircuit.go:49 +0x29b
github.com/consensys/gnark/test.(*Assert).Run.func1(0xc00032c9c0)
	/home/runner/work/gnark/gnark/test/assert.go:66 +0xa7
testing.tRunner(0xc00032c9c0, 0xc000382000)
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 292
	/opt/hostedtoolcache/go/1.21.1/x64/src/testing/testing.go:1648 +0x3ad

Copy link

github-actions bot commented Nov 9, 2023

📦 github.com/consensys/gnark/std/math/emulated
TestInverse 0s

TestInverse/Goldilocks/limb=64 0s

TestInverse/Goldilocks/limb=64/bn254 0s

panic: test timed out after 30m0s
running tests:
	TestInverse (30m0s)
	TestInverse/Goldilocks/limb=64 (30m0s)
	TestInverse/Goldilocks/limb=64/bn254 (30m0s)

goroutine 293 [running]:
testing.(*M).startAlarm.func1()
	/opt/hostedtoolcache/go/1.21.3/x64/src/testing/testing.go:2259 +0x3b9
created by time.goFunc
	/opt/hostedtoolcache/go/1.21.3/x64/src/time/sleep.go:176 +0x2d

goroutine 1 [chan receive, 29 minutes]:
testing.(*T).Run(0xc0000d7040, {0xeae1e3?, 0x51fadc?}, 0xf1aa90)
	/opt/hostedtoolcache/go/1.21.3/x64/src/testing/testing.go:1649 +0x3c8
testing.runTests.func1(0x155dec0?)
	/opt/hostedtoolcache/go/1.21.3/x64/src/testing/testing.go:2054 +0x3e
testing.tRunner(0xc0000d7040, 0xc000135c48)
	/opt/hostedtoolcache/go/1.21.3/x64/src/testing/testing.go:1595 +0xff
testing.runTests(0xc000125180?, {0x1554980, 0x1d, 0x1d}, {0x4182bf?, 0xc000135d08?, 0x155c520?})
	/opt/hostedtoolcache/go/1.21.3/x64/src/testing/testing.go:2052 +0x445
testing.(*M).Run(0xc000125180)
	/opt/hostedtoolcache/go/1.21.3/x64/src/testing/testing.go:1925 +0x636
main.main()
	_testmain.go:109 +0x19c

goroutine 225 [chan receive, 29 minutes]:
testing.(*T).Run(0xc0000d6000, {0xc0000321b0?, 0xc0007456d0?}, 0xc000212090)
	/opt/hostedtoolcache/go/1.21.3/x64/src/testing/testing.go:1649 +0x3c8
github.com/consensys/gnark/test.(*Assert).Run(0xc000745718, 0xc000212080, {0xc000745728?, 0x39?, 0x5ad?})
	/home/runner/work/gnark/gnark/test/assert.go:64 +0x99
github.com/consensys/gnark/std/math/emulated.testInverse[...](0xc0000d6000)
	/home/runner/work/gnark/gnark/std/math/emulated/element_test.go:403 +0x107
github.com/consensys/gnark/std/math/emulated.TestInverse(0x0?)
	/home/runner/work/gnark/gnark/std/math/emulated/element_test.go:392 +0x25
testing.tRunner(0xc0000d6000, 0xf1aa90)
	/opt/hostedtoolcache/go/1.21.3/x64/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 1
	/opt/hostedtoolcache/go/1.21.3/x64/src/testing/testing.go:1648 +0x3ad

goroutine 307 [runnable]:
internal/reflectlite.Value.Set({0xe46c40?, 0xc00057c360?, 0x199?}, {0xe46c40?, 0xc00068bbf0?, 0x99?})
	/opt/hostedtoolcache/go/1.21.3/x64/src/internal/reflectlite/value.go:361 +0x105
errors.As({0x100a580, 0xc00068bbf0}, {0xdadaa0?, 0xc00057c360})
	/opt/hostedtoolcache/go/1.21.3/x64/src/errors/wrap.go:111 +0x434
github.com/consensys/gnark/std/math/emulated.(*Field[...]).reduceAndOp(0x10202a0?, 0xc0000d3b58, 0xc0000d3b40, 0xc0002b82d0, 0x0)
	/home/runner/work/gnark/gnark/std/math/emulated/field_ops.go:402 +0xe6
github.com/consensys/gnark/std/math/emulated.(*Field[...]).Inverse(0x1018d38?, 0xc00012c000?)
	/home/runner/work/gnark/gnark/std/math/emulated/field_ops.go:44 +0x7b
github.com/consensys/gnark/std/math/emulated.(*InverseCircuit[...]).Define(0x100ca40, {0x1018d38, 0xc00012c000?})
	/home/runner/work/gnark/gnark/std/math/emulated/element_test.go:386 +0x65
github.com/consensys/gnark/test.IsSolved({0x100aa40, 0xc0002b8000}, {0x100aa40, 0xc0002b8050}, 0xc000394420, {0x0, 0x0, 0x0?})
	/home/runner/work/gnark/gnark/test/engine.go:131 +0x445
github.com/consensys/gnark/test.(*Assert).CheckCircuit.func1(0x0?)
	/home/runner/work/gnark/gnark/test/assert_checkcircuit.go:49 +0x29b
github.com/consensys/gnark/test.(*Assert).Run.func1(0xc0000d6340)
	/home/runner/work/gnark/gnark/test/assert.go:66 +0xa7
testing.tRunner(0xc0000d6340, 0xc000212130)
	/opt/hostedtoolcache/go/1.21.3/x64/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 306
	/opt/hostedtoolcache/go/1.21.3/x64/src/testing/testing.go:1648 +0x3ad

goroutine 306 [chan receive, 29 minutes]:
testing.(*T).Run(0xc0000d61a0, {0xc00035a0d0?, 0xc000081ce0?}, 0xc000212130)
	/opt/hostedtoolcache/go/1.21.3/x64/src/testing/testing.go:1649 +0x3c8
github.com/consensys/gnark/test.(*Assert).Run(0xc0002120f0, 0xc00057c0f0, {0xc000081e08?, 0x151332c?, 0x2?})
	/home/runner/work/gnark/gnark/test/assert.go:64 +0x99
github.com/consensys/gnark/test.(*Assert).CheckCircuit(0xc000394060?, {0x100aa40?, 0xc0002b8000}, {0xc000081e88, 0x1, 0x1})
	/home/runner/work/gnark/gnark/test/assert_checkcircuit.go:39 +0x150
github.com/consensys/gnark/std/math/emulated.testInverse[...].func1()
	/home/runner/work/gnark/gnark/std/math/emulated/element_test.go:409 +0x2bd
github.com/consensys/gnark/test.(*Assert).Run.func1(0xc0000d61a0)
	/home/runner/work/gnark/gnark/test/assert.go:66 +0xa7
testing.tRunner(0xc0000d61a0, 0xc000212090)
	/opt/hostedtoolcache/go/1.21.3/x64/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 225
	/opt/hostedtoolcache/go/1.21.3/x64/src/testing/testing.go:1648 +0x3ad

@ivokub ivokub merged commit 189f3a2 into master Nov 10, 2023
6 of 7 checks passed
@ivokub ivokub deleted the fix/nna-autoreduce branch November 10, 2023 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: omitted automatic reductions for Div, Inverse and Sqrt in field emulation
2 participants