Skip to content

Commit b75e1e2

Browse files
committed
Measure block verification time
1 parent 12ac9aa commit b75e1e2

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

operator/mina/mina.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,24 @@ package mina
88
*/
99
import "C"
1010
import (
11+
"fmt"
12+
"time"
1113
"unsafe"
1214
)
1315

1416
// TODO(xqft): check proof size
1517
const MAX_PROOF_SIZE = 16 * 1024
1618
const MAX_PUB_INPUT_SIZE = 6 * 1024
1719

20+
func timer() func() {
21+
start := time.Now()
22+
return func() {
23+
fmt.Printf("Mina block verification took %v\n", time.Since(start))
24+
}
25+
}
26+
1827
func VerifyProtocolStateProof(proofBuffer [MAX_PROOF_SIZE]byte, proofLen uint, pubInputBuffer [MAX_PUB_INPUT_SIZE]byte, pubInputLen uint) bool {
28+
defer timer()()
1929
proofPtr := (*C.uchar)(unsafe.Pointer(&proofBuffer[0]))
2030
pubInputPtr := (*C.uchar)(unsafe.Pointer(&pubInputBuffer[0]))
2131
return (bool)(C.verify_protocol_state_proof_ffi(proofPtr, (C.uint)(proofLen), pubInputPtr, (C.uint)(pubInputLen)))

0 commit comments

Comments
 (0)