diff --git a/.github/workflows/ckzg-test.yml b/.github/workflows/c-tests.yml similarity index 77% rename from .github/workflows/ckzg-test.yml rename to .github/workflows/c-tests.yml index dc0b27c..4721b70 100644 --- a/.github/workflows/ckzg-test.yml +++ b/.github/workflows/c-tests.yml @@ -1,4 +1,4 @@ -name: CKZG tests +name: C on: push: branches: @@ -8,12 +8,17 @@ on: - main jobs: - test-ckzg: + tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: submodules: recursive + - name: Check formatting + run: | + cd src + make format + git diff --exit-code - name: Build run: | cd src @@ -23,6 +28,10 @@ jobs: run: | cd src make test + - name: Clang Sanitizers + run: | + cd src + make sanitize - name: Clang Static Analyzer run: | cd src diff --git a/.github/workflows/csharp-bindings-build.yml b/.github/workflows/csharp-tests.yml similarity index 99% rename from .github/workflows/csharp-bindings-build.yml rename to .github/workflows/csharp-tests.yml index 002adf3..a34b0b8 100644 --- a/.github/workflows/csharp-bindings-build.yml +++ b/.github/workflows/csharp-tests.yml @@ -1,4 +1,4 @@ -name: C# bindings test and build +name: C# on: workflow_dispatch: inputs: diff --git a/.github/workflows/format-test.yml b/.github/workflows/format-test.yml deleted file mode 100644 index 8e7f787..0000000 --- a/.github/workflows/format-test.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Formatting tests -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - test-format: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - name: Check formatting - run: | - cd src - make format - git diff --exit-code diff --git a/.github/workflows/go-bindings-test.yml b/.github/workflows/go-tests.yml similarity index 80% rename from .github/workflows/go-bindings-test.yml rename to .github/workflows/go-tests.yml index 533b379..cf949aa 100644 --- a/.github/workflows/go-bindings-test.yml +++ b/.github/workflows/go-tests.yml @@ -1,4 +1,4 @@ -name: Go bindings tests +name: Go on: push: branches: @@ -8,7 +8,7 @@ on: - main jobs: - test-go-bindings: + tests: runs-on: ubuntu-latest steps: - name: Setup Go @@ -22,7 +22,11 @@ jobs: - name: Test run: | cd bindings/go - go test . + go test + - name: Benchmark + run: | + cd bindings/go + go test -bench=Benchmark - name: Check headers run: | cmp blst/bindings/blst.h bindings/go/blst_headers/blst.h diff --git a/.github/workflows/java-bindings-test.yml b/.github/workflows/java-tests.yml similarity index 93% rename from .github/workflows/java-bindings-test.yml rename to .github/workflows/java-tests.yml index 46585b4..c837205 100644 --- a/.github/workflows/java-bindings-test.yml +++ b/.github/workflows/java-tests.yml @@ -1,4 +1,4 @@ -name: Java bindings tests +name: Java on: push: @@ -9,7 +9,7 @@ on: - main jobs: - test-java-bindings: + tests: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] diff --git a/.github/workflows/nim-bindings-test.yml b/.github/workflows/nim-tests.yml similarity index 97% rename from .github/workflows/nim-bindings-test.yml rename to .github/workflows/nim-tests.yml index 84b7901..b85fa63 100644 --- a/.github/workflows/nim-bindings-test.yml +++ b/.github/workflows/nim-tests.yml @@ -1,4 +1,4 @@ -name: Nim bindings tests +name: Nim on: push: branches: @@ -8,7 +8,7 @@ on: - main jobs: - test: + tests: runs-on: ${{ matrix.os }} strategy: matrix: diff --git a/.github/workflows/nodejs-bindings-test.yml b/.github/workflows/nodejs-tests.yml similarity index 86% rename from .github/workflows/nodejs-bindings-test.yml rename to .github/workflows/nodejs-tests.yml index 7cbd41b..e446b95 100644 --- a/.github/workflows/nodejs-bindings-test.yml +++ b/.github/workflows/nodejs-tests.yml @@ -1,4 +1,4 @@ -name: NodeJS bindings tests +name: NodeJS on: push: branches: @@ -8,7 +8,7 @@ on: - main jobs: - test-nodejs-bindings: + tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/python-bindings-test.yml b/.github/workflows/python-tests.yml similarity index 94% rename from .github/workflows/python-bindings-test.yml rename to .github/workflows/python-tests.yml index d4b3a59..08e9e1f 100644 --- a/.github/workflows/python-bindings-test.yml +++ b/.github/workflows/python-tests.yml @@ -1,4 +1,4 @@ -name: Python bindings tests +name: Python on: push: branches: @@ -8,7 +8,7 @@ on: - main jobs: - test-python-bindings: + tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/rust-bindings-test.yml b/.github/workflows/rust-tests.yml similarity index 92% rename from .github/workflows/rust-bindings-test.yml rename to .github/workflows/rust-tests.yml index 14dbd7b..93c013c 100644 --- a/.github/workflows/rust-bindings-test.yml +++ b/.github/workflows/rust-tests.yml @@ -1,4 +1,4 @@ -name: Rust bindings tests +name: Rust on: push: branches: @@ -8,7 +8,7 @@ on: - main jobs: - test-rust-bindings: + tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/src/Makefile b/src/Makefile index 209f205..488067f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -95,6 +95,30 @@ profile: \ profile_verify_blob_kzg_proof \ profile_verify_blob_kzg_proof_batch +.PHONY: sanitize_% +sanitize_%: test_c_kzg_4844.c c_kzg_4844.c + @echo Running sanitize=$*... + @$(CC) $(CFLAGS) $(NO_OPTIMIZE) -fsanitize=$* -o $@ $< $(BLST) + @ASAN_OPTIONS=allocator_may_return_null=1 \ + LSAN_OPTIONS=allocator_may_return_null=1 \ + ./$@; rm $@ + +ifneq ($(OS),Windows_NT) +UNAME_S := $(shell uname -s) +.PHONY: sanitize +ifeq ($(UNAME_S),Darwin) +sanitize: \ + sanitize_address \ + sanitize_undefined +else +sanitize: \ + sanitize_address \ + sanitize_leak \ + sanitize_safe-stack \ + sanitize_undefined +endif +endif + .PHONY: analyze analyze: c_kzg_4844.c @$(CC) --analyze -Xanalyzer -analyzer-output=html \ diff --git a/src/test_c_kzg_4844.c b/src/test_c_kzg_4844.c index df43a20..52b382f 100644 --- a/src/test_c_kzg_4844.c +++ b/src/test_c_kzg_4844.c @@ -259,7 +259,7 @@ static void test_fr_pow__test_inverse_on_root_of_unity(void) { blst_fr_from_uint64(&a, SCALE2_ROOT_OF_UNITY[31]); - fr_pow(&r, &a, 1 << 31); + fr_pow(&r, &a, 1ULL << 31); bool ok = fr_equal(&r, &FR_ONE); ASSERT_EQUALS(ok, true);