From 928fd9d9b7d827b90545a15da36ebda1d7f4a5a8 Mon Sep 17 00:00:00 2001 From: Justin Traglia <95511699+jtraglia@users.noreply.github.com> Date: Fri, 7 Apr 2023 07:57:48 -0500 Subject: [PATCH] [Go] Allow minimal preset (#283) --- bindings/go/README.md | 8 ++++++++ bindings/go/main.go | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/bindings/go/README.md b/bindings/go/README.md index 9245ddd..ae68d7c 100644 --- a/bindings/go/README.md +++ b/bindings/go/README.md @@ -40,6 +40,14 @@ Run the benchmarks with this command: go test -bench=Benchmark ``` +## Minimal + +By default, `FIELD_ELEMENTS_PER_BLOB` will be 4096 (mainnet), but you can +manually set it to 4 (minimal), like so: +``` +CGO_CFLAGS="-DFIELD_ELEMENTS_PER_BLOB=4" go build +``` + ## Note The `go.mod` and `go.sum` files are in the project's root directory because the diff --git a/bindings/go/main.go b/bindings/go/main.go index 4555c1d..4450c7e 100644 --- a/bindings/go/main.go +++ b/bindings/go/main.go @@ -2,7 +2,9 @@ package cgokzg4844 // #cgo CFLAGS: -I${SRCDIR}/../../src // #cgo CFLAGS: -I${SRCDIR}/blst_headers -// #cgo CFLAGS: -DFIELD_ELEMENTS_PER_BLOB=4096 +// #ifndef FIELD_ELEMENTS_PER_BLOB +// #define FIELD_ELEMENTS_PER_BLOB 4096 +// #endif // #include "c_kzg_4844.c" import "C"