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

Shuffle(sortedProposedBlocks) is also changing the original SortedProposedBlocks[] #956

Closed
Yashk767 opened this issue Sep 30, 2022 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Yashk767
Copy link
Contributor

Describe the bug

We shuffle the sortedProposedBlocks during dispute state so that every staker follows different order when iterating over blocks for dispute.
The Shuffle() function which we are using is also changing the original sortedProposedBlocks array resulting in fetching of wrong blockIndex

for e.g  - 
sortedProposedBlocks= [5,4,2,3,1]

randomSortedProposedBlocks =  Shuffle[sortedProposedBlocks]
randomSortedProposedBlocks = [4,5,1,2,3]

Ideally sortedProposedBlocks should be same i.e [5,4,2,3,1]

But it also changes,
sortedProposedBlocks = [4,5,1,2,3]

it follows sortedProposedBlocks = randomSortedProposedBlocks
@Yashk767 Yashk767 added the bug Something isn't working label Sep 30, 2022
@Yashk767 Yashk767 self-assigned this Sep 30, 2022
@Yashk767 Yashk767 added this to the v1.3.0-alpha milestone Oct 6, 2022
@Yashk767 Yashk767 closed this as completed Oct 6, 2022
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

No branches or pull requests

1 participant