Skip to content

optimizations for commitVector#43

Closed
HayimShaul wants to merge 4 commits into
IBM:mainfrom
HayimShaul:bl12381-opt
Closed

optimizations for commitVector#43
HayimShaul wants to merge 4 commits into
IBM:mainfrom
HayimShaul:bl12381-opt

Conversation

@HayimShaul

Copy link
Copy Markdown
Member

No description provided.

Signed-off-by: Hayim Shaul <hayim.shaul@ibm.com>

@adecaro adecaro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the submission.
Please, fix the DCO and add unit-test for the new function AddPairsOfProducts.

Signed-off-by: Hayim Shaul <hayim.shaul@ibm.com>
@HayimShaul HayimShaul requested a review from adecaro February 3, 2026 07:32
Comment thread addpairsofproducts_test.go
@adecaro

adecaro commented Feb 3, 2026

Copy link
Copy Markdown
Member

Hi @HayimShaul , it looks good to me apart from the position of the test function.
I'll let @ale-linux have the last work because he is main contributor of the library.
Thanks for the effort.

Signed-off-by: Hayim Shaul <hayim.shaul@ibm.com>
@HayimShaul HayimShaul requested a review from adecaro February 3, 2026 14:04

@ale-linux ale-linux left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM - just two minor nits

Comment thread driver/common/curve.go
func (p *CurveBase) AddPairsOfProducts(left []driver.Zr, right []driver.Zr, leftgen []driver.G1, rightgen []driver.G1) driver.G1 {
sum := leftgen[0].Mul2(left[0], rightgen[0], right[0])
for i := 1; i < len(left); i++ {
sum.Add(leftgen[i].Mul2(left[i], rightgen[i], right[i]))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this function will panic if lengths are mismatched... @adecaro what do you think? We obviously can't return an error, so panic is right, how about a length check and a panic if it fails? Or are you concerned about performance?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think an if that panic with a better message is totally fine.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have just noticed that we don't have a check on ModAddMul though.

@HayimShaul HayimShaul Feb 4, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

so what's the conclusion?
add the check in AddPairsOfProducts and ModAddMul? or no need to check in both?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd vote in favour of adding length checks and panic if they fail in all implementations of all vectored implementations

Comment thread driver/gurvy/bls12381/bls12-381.go Outdated
Signed-off-by: Hayim Shaul <hayim.shaul@ibm.com>
@HayimShaul HayimShaul closed this Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants