diff --git a/Makefile b/Makefile index 556b0c8..d26b514 100644 --- a/Makefile +++ b/Makefile @@ -6,9 +6,9 @@ build: build-tfhe-rs-capi test: build-tfhe-rs-capi cd fhevm && go test -v . -.PHONY: benchmarks -benchmarks: build-tfhe-rs-capi - cd fhevm && go test -count=1 -v . -run Benchmarks +.PHONY: gasEstimation +gasEstimation: build-tfhe-rs-capi + cd fhevm && go test -count=1 -v . -run GasEstimation .PHONY: build-tfhe-rs-capi build-tfhe-rs-capi: diff --git a/fhevm/benchmarks_test.go b/fhevm/benchmarks_test.go index ef57018..d747627 100644 --- a/fhevm/benchmarks_test.go +++ b/fhevm/benchmarks_test.go @@ -38,36 +38,36 @@ func runTest(t *testing.T, name string, fn operation, bits string, fheUintType F convertInGas(t, name+bits, elapsed) } -func benchTests(t *testing.T, name string, fn operation) { +func estimateTests(t *testing.T, name string, fn operation) { runTest(t, name, fn, "8", FheUint8) runTest(t, name, fn, "16", FheUint16) runTest(t, name, fn, "32", FheUint32) } -func TestBenchmarks(t *testing.T) { - benchTests(t, "not", func(fheUintType FheUintType) { FheNot(t, fheUintType, false) }) +func TestGasEstimation(t *testing.T) { + estimateTests(t, "not", func(fheUintType FheUintType) { FheNot(t, fheUintType, false) }) - benchTests(t, "and", func(fheUintType FheUintType) { FheBitAnd(t, fheUintType, false) }) + estimateTests(t, "and", func(fheUintType FheUintType) { FheBitAnd(t, fheUintType, false) }) - benchTests(t, "eq", func(fheUintType FheUintType) { FheEq(t, fheUintType, false) }) - benchTests(t, "ScalarEq", func(fheUintType FheUintType) { FheEq(t, fheUintType, true) }) + estimateTests(t, "eq", func(fheUintType FheUintType) { FheEq(t, fheUintType, false) }) + estimateTests(t, "ScalarEq", func(fheUintType FheUintType) { FheEq(t, fheUintType, true) }) - benchTests(t, "shr", func(fheUintType FheUintType) { FheShr(t, fheUintType, false) }) - benchTests(t, "ScalarShr", func(fheUintType FheUintType) { FheShr(t, fheUintType, true) }) + estimateTests(t, "shr", func(fheUintType FheUintType) { FheShr(t, fheUintType, false) }) + estimateTests(t, "ScalarShr", func(fheUintType FheUintType) { FheShr(t, fheUintType, true) }) - benchTests(t, "min", func(fheUintType FheUintType) { FheMin(t, fheUintType, false) }) - benchTests(t, "ScalarMin", func(fheUintType FheUintType) { FheMin(t, fheUintType, true) }) + estimateTests(t, "min", func(fheUintType FheUintType) { FheMin(t, fheUintType, false) }) + estimateTests(t, "ScalarMin", func(fheUintType FheUintType) { FheMin(t, fheUintType, true) }) - benchTests(t, "add", func(fheUintType FheUintType) { FheAdd(t, fheUintType, false) }) - benchTests(t, "ScalarAdd", func(fheUintType FheUintType) { FheAdd(t, fheUintType, true) }) + estimateTests(t, "add", func(fheUintType FheUintType) { FheAdd(t, fheUintType, false) }) + estimateTests(t, "ScalarAdd", func(fheUintType FheUintType) { FheAdd(t, fheUintType, true) }) - benchTests(t, "sub", func(fheUintType FheUintType) { FheSub(t, fheUintType, false) }) - benchTests(t, "ScalarSub", func(fheUintType FheUintType) { FheSub(t, fheUintType, true) }) + estimateTests(t, "sub", func(fheUintType FheUintType) { FheSub(t, fheUintType, false) }) + estimateTests(t, "ScalarSub", func(fheUintType FheUintType) { FheSub(t, fheUintType, true) }) - benchTests(t, "mul", func(fheUintType FheUintType) { FheMul(t, fheUintType, false) }) - benchTests(t, "ScalarMul", func(fheUintType FheUintType) { FheMul(t, fheUintType, true) }) + estimateTests(t, "mul", func(fheUintType FheUintType) { FheMul(t, fheUintType, false) }) + estimateTests(t, "ScalarMul", func(fheUintType FheUintType) { FheMul(t, fheUintType, true) }) - benchTests(t, "ScalarDiv", func(fheUintType FheUintType) { FheDiv(t, fheUintType, true) }) + estimateTests(t, "ScalarDiv", func(fheUintType FheUintType) { FheDiv(t, fheUintType, true) }) - benchTests(t, "IfThenElse", func(fheUintType FheUintType) { FheIfThenElse(t, fheUintType, 1) }) + estimateTests(t, "IfThenElse", func(fheUintType FheUintType) { FheIfThenElse(t, fheUintType, 1) }) }