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

[BUG FIX] constraint: serializeCommitment #651

Merged
merged 1 commit into from
Apr 20, 2023

Conversation

SherLzp
Copy link
Contributor

@SherLzp SherLzp commented Apr 19, 2023

See the issue here: #645

Change the original code:

func (i *Commitment) SerializeCommitment(privateCommitment []byte, publicCommitted []*big.Int, fieldByteLen int) []byte {

	res := make([]byte, len(privateCommitment)+len(publicCommitted)*fieldByteLen)
	copy(res, privateCommitment)

	offset := len(privateCommitment)
	for j, inJ := range publicCommitted {
		offset += j * fieldByteLen
		inJ.FillBytes(res[offset : offset+fieldByteLen])
	}

	return res
}

to

func (i *Commitment) SerializeCommitment(privateCommitment []byte, publicCommitted []*big.Int, fieldByteLen int) []byte {

	res := make([]byte, len(privateCommitment)+len(publicCommitted)*fieldByteLen)
	copy(res, privateCommitment)

	offset := len(privateCommitment)
	for _, inJ := range publicCommitted {
		inJ.FillBytes(res[offset : offset+fieldByteLen])
		offset += fieldByteLen
	}

	return res
}

@ivokub ivokub self-requested a review April 19, 2023 21:57
@ivokub ivokub added the bug Something isn't working label Apr 19, 2023
@ivokub ivokub added this to the v0.9.0 milestone Apr 19, 2023
@ivokub
Copy link
Collaborator

ivokub commented Apr 20, 2023

Looks good to me, pinging @Tabaie to confirm.

@Tabaie
Copy link
Contributor

Tabaie commented Apr 20, 2023

LGTM!

Copy link
Collaborator

@ivokub ivokub left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

@ivokub ivokub merged commit ee248a4 into Consensys:develop Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants