Skip to content

cgo: Properly manage memory passing from cgo to go on Batch Verifiers#5700

Merged
algorandskiy merged 13 commits intoalgorand:masterfrom
algonautshant:shant/cgo-fix
Nov 17, 2023
Merged

cgo: Properly manage memory passing from cgo to go on Batch Verifiers#5700
algorandskiy merged 13 commits intoalgorand:masterfrom
algonautshant:shant/cgo-fix

Conversation

@algonautshant
Copy link
Copy Markdown
Contributor

@algonautshant algonautshant commented Aug 22, 2023

Fixing https://github.com/algorand/go-algorand-internal/issues/3011

  1. Prepare a contiguous memory block for messages, without additional copying
  2. Use the provided wrapper C function to avoid the use of unsafe pointers

From #5695:

This updates the batchVerifier and its enqueue function to build up a 1-dimensional byte slice, rather than a slice of slices or a slice of arrays, for passing to the C batch verification code. This removes the need to build them on demand in batchVerificationImpl. A new C function acts as a shim between Go and C.

@algonautshant algonautshant self-assigned this Aug 22, 2023
@algonautshant algonautshant changed the title batchProperly manage memory passing from cgo to go on Batch Verifiers cgo: Properly manage memory passing from cgo to go on Batch Verifiers Aug 22, 2023
@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 22, 2023

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (b19594e) 55.25% compared to head (a50dc52) 55.24%.
Report is 112 commits behind head on master.

Files Patch % Lines
crypto/curve25519.go 33.33% 4 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5700      +/-   ##
==========================================
- Coverage   55.25%   55.24%   -0.01%     
==========================================
  Files         473      473              
  Lines       66166    66182      +16     
==========================================
+ Hits        36558    36565       +7     
- Misses      27146    27148       +2     
- Partials     2462     2469       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment thread crypto/onetimesig.go Outdated
Comment thread crypto/batchverifier.c
algonautshant and others added 2 commits August 28, 2023 21:45
Co-authored-by: Pavel Zbitskiy <65323360+algorandskiy@users.noreply.github.com>
@algonautshant algonautshant marked this pull request as ready for review August 29, 2023 04:56
Comment thread crypto/batchverifier.go Outdated
Comment thread crypto/batchverifier.go Outdated
algorandskiy
algorandskiy previously approved these changes Aug 30, 2023
@cce cce requested review from jannotti and zeldovich November 16, 2023 16:57
jannotti
jannotti previously approved these changes Nov 16, 2023
Copy link
Copy Markdown
Contributor

@jannotti jannotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks right to me.

Comment thread crypto/batchverifier.c Outdated
Comment thread crypto/batchverifier.c Outdated
Comment thread crypto/batchverifier.go Outdated
Comment thread crypto/batchverifier.go Outdated
zeldovich
zeldovich previously approved these changes Nov 16, 2023
Comment thread crypto/batchverifier.go Outdated
@cce cce dismissed stale reviews from zeldovich, jannotti, and algorandskiy via a50dc52 November 17, 2023 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants