Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 13 commits into from
Nov 17, 2023

Conversation

algonautshant
Copy link
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

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.

crypto/onetimesig.go Outdated Show resolved Hide resolved
crypto/batchverifier.c Show resolved Hide resolved
@algonautshant algonautshant marked this pull request as ready for review August 29, 2023 04:56
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
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.

crypto/batchverifier.c Outdated Show resolved Hide resolved
crypto/batchverifier.c Outdated Show resolved Hide resolved
crypto/batchverifier.go Outdated Show resolved Hide resolved
crypto/batchverifier.go Outdated Show resolved Hide resolved
zeldovich
zeldovich previously approved these changes Nov 16, 2023
crypto/batchverifier.go Outdated Show resolved Hide resolved
@cce cce dismissed stale reviews from zeldovich, jannotti, and algorandskiy via a50dc52 November 17, 2023 18:15
@algorandskiy algorandskiy merged commit 5b62dc0 into algorand:master Nov 17, 2023
18 checks passed
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