herumi/bls-eth-go-binary

go test ./bls -bench "Pairing|Sign|Verify" panic

hopwesley opened this issue · 1 comments

go test ./bls -bench "Pairing|Sign|Verify"
default
i=0 sec={{{[1953140109209271959 10705627224465368322 7174701093415440548 1258630426541806124]}}}
i=1 sec={{{[8457362511241457538 9670161164156545641 9105405484143105678 3320580800943532807]}}}
i=2 sec={{{[14325530741242932119 2341127126267580347 16099995215189520559 6712677111185580948]}}}
i=3 sec={{{[6569493722746513012 1919731170778165296 13493853339804019477 4161142440363453388]}}}
i=4 sec={{{[10678260665750190782 3253206453093759207 14485260631969334359 5681122663530763174]}}}
i=5 sec={{{[3313129746497182542 17795659605929235688 15971784143008541800 5736204275063667834]}}}
i=6 sec={{{[5645313989405153868 5032451873770396831 3620318529443575703 8004655668189853017]}}}
i=7 sec={{{[12144918763182913568 1587434566958444062 2791532287187900188 6676946991113696789]}}}
i=8 sec={{{[9044949061359553736 11905660744842760789 16839103139570732791 1462438068823424496]}}}
i=9 sec={{{[3770675982602799006 12830714004747369416 1057511138454417752 5276836148872168205]}}}
rand.Reader
i=0 sec={{{[4522117038810064540 14201839792875455574 11256533246278228819 3919263963739128063]}}}
i=1 sec={{{[15485364699371611584 174870878169377009 10202043535008233510 5824730777928762366]}}}
i=2 sec={{{[12372453796144583379 6022980071146894139 7230058668899607254 552012814495939389]}}}
i=3 sec={{{[15966355540890054897 12592283730314278844 11107603305502319876 6006904619880624822]}}}
i=4 sec={{{[10076372930960243499 1987295788149446165 3585457930190028702 5528571545462136514]}}}
i=5 sec={{{[16867023202087447712 16852604711492557522 2437993409474990119 5429053143646682660]}}}
i=6 sec={{{[9990579725276471976 81034314691499620 518622142718236414 7070008167273499651]}}}
i=7 sec={{{[4434425711303930340 11067994385894484558 7065092796412658703 6844321189869175704]}}}
i=8 sec={{{[6249628751698825002 10727902409890117831 16226564738108063042 2338093914506780057]}}}
i=9 sec={{{[12339656037976336182 6484407747234926782 5395375552283860775 4695439495944817792]}}}
goos: darwin
goarch: amd64
pkg: github.com/herumi/bls-eth-go-binary/bls
cpu: Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
BenchmarkPairing-6 1941 605234 ns/op
BenchmarkSignHash-6 2637 433856 ns/op
BenchmarkVerifyHash-6 1136 1047905 ns/op
panic: err mclBnFp_setByCSPRNG

goroutine 29 [running]:
github.com/herumi/bls-eth-go-binary/bls.(*Fp).SetByCSPRNG(...)
/Users/hyperorchid/xcodedata/bls-eth-go-binary/bls/mcl.go:402
github.com/herumi/bls-eth-go-binary/bls.getSecPubHashVec(0x32, 0x0, 0x0, 0xc000274690, 0xc039efe3d2, 0x27a39efe3d2, 0x100000001, 0xc0002746d0, 0x406a83b, 0x27a39efe3d2)
/Users/hyperorchid/xcodedata/bls-eth-go-binary/bls/bls_test.go:120 +0x2f7
github.com/herumi/bls-eth-go-binary/bls.BenchmarkVerifyAggreageteHash(0xc000512480)
/Users/hyperorchid/xcodedata/bls-eth-go-binary/bls/bls_test.go:629 +0xc7
testing.(*B).runN(0xc000512480, 0x1)
/usr/local/Cellar/go/1.16.2/libexec/src/testing/benchmark.go:192 +0xeb
testing.(*B).run1.func1(0xc000512480)
/usr/local/Cellar/go/1.16.2/libexec/src/testing/benchmark.go:232 +0x57
created by testing.(*B).run1
/usr/local/Cellar/go/1.16.2/libexec/src/testing/benchmark.go:225 +0x7f
exit status 2

It seems to happen only on darwin.
I've removed SetRandFunc in bls_test.go
9588dcf