Skip to content

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 type: 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

type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants