Skip to content

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

@Yashk767

Description

@Yashk767

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions