From ae2db332a55dba71735fc0752ae49d50381e885d Mon Sep 17 00:00:00 2001 From: Justin Traglia <95511699+jtraglia@users.noreply.github.com> Date: Fri, 7 Apr 2023 07:57:27 -0500 Subject: [PATCH] [Go] Use BYTES_PER_G* instead of 48/96 (#284) --- bindings/go/main.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bindings/go/main.go b/bindings/go/main.go index e88f58e..4555c1d 100644 --- a/bindings/go/main.go +++ b/bindings/go/main.go @@ -78,14 +78,14 @@ func LoadTrustedSetup(g1Bytes, g2Bytes []byte) error { if loaded { panic("trusted setup is already loaded") } - if len(g1Bytes)%48 != 0 { - panic("len(g1Bytes) is not a multiple of 48") + if len(g1Bytes)%C.BYTES_PER_G1 != 0 { + panic(fmt.Sprintf("len(g1Bytes) is not a multiple of %v", C.BYTES_PER_G1)) } - if len(g2Bytes)%96 != 0 { - panic("len(g2Bytes) is not a multiple of 96") + if len(g2Bytes)%C.BYTES_PER_G2 != 0 { + panic(fmt.Sprintf("len(g2Bytes) is not a multiple of %v", C.BYTES_PER_G2)) } - numG1Elements := len(g1Bytes) / 48 - numG2Elements := len(g2Bytes) / 96 + numG1Elements := len(g1Bytes) / C.BYTES_PER_G1 + numG2Elements := len(g2Bytes) / C.BYTES_PER_G2 ret := C.load_trusted_setup( &settings, *(**C.uint8_t)(unsafe.Pointer(&g1Bytes)),