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

Add support in sortition for bls public keys that starts with zeros #1457

Closed
goshawk-3 opened this issue Aug 26, 2022 · 0 comments · Fixed by #1458
Closed

Add support in sortition for bls public keys that starts with zeros #1457

goshawk-3 opened this issue Aug 26, 2022 · 0 comments · Fixed by #1458
Assignees
Labels
mark:testnet type:vulnerability Issues related to fix vulnerabilities of the architecture or software

Comments

@goshawk-3
Copy link
Contributor

Describe the bug
p.MemberAt(i) in extractCommitteeMember would return nil member making the sortition panic, when a provisioner public key starts with zeros.

To Reproduce

  1. Try to generate a valid BLS key where the public key starts with zeros
  2. Stake with it
  3. If extractCommitteeMember loop reaches this member, it will panic.

Expected behaviour
As it is an existing item, p.MemberAt(i) should return the real member but not nil. To achieve this, Int.FillBytes should be used.

Additional context

func TestSetBytes(t *testing.T) {
	b1 := decodeString("0000d081884c")
	bigInt1 := new(big.Int).SetBytes(b1)

	b2 := bigInt1.Bytes()

	assert.True(t, bytes.Equal(b1, b2))
	// failed
}
@goshawk-3 goshawk-3 added the type:vulnerability Issues related to fix vulnerabilities of the architecture or software label Aug 26, 2022
@goshawk-3 goshawk-3 self-assigned this Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mark:testnet type:vulnerability Issues related to fix vulnerabilities of the architecture or software
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants