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

Incorrect hash: sharderKeys used in place of mpkKeys while calculating magic block hash #146

Closed
bbist opened this issue Apr 4, 2021 · 3 comments
Assignees

Comments

@bbist
Copy link
Contributor

bbist commented Apr 4, 2021

In file 0chain.net/chaincore/block/magic_block_entity.go, method GetHashBytes uses value sharderKeys instead of mpkKeys in line 85, to iterate over and append to data variable. It seems like a bug.

func (mb *MagicBlock) GetHashBytes() []byte {
        ...
        ...
	sort.Strings(mpkKeys)
->	for _, v := range sharderKeys {
		data = append(data, []byte(v)...)
	}
	data = append(data, []byte(strconv.Itoa(mb.T))...)
	data = append(data, []byte(strconv.Itoa(mb.N))...)
	return encryption.RawHash(data)
}
@bbist
Copy link
Contributor Author

bbist commented Apr 4, 2021

Here's the reference to the change: 27199b9
This is probably the intention.

@guruhubb
Copy link
Member

@peterlimg is this closed?

@peterlimg
Copy link
Member

yes, this is closed by #147

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

No branches or pull requests

3 participants