Skip to content

Commit

Permalink
Fix bitwise op bug that occurs while checking if signature exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
bunnie307 committed Dec 29, 2023
1 parent 28edf40 commit 00c6183
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ private boolean mask(int nth) {
Context.require(nth <= 64, "Invalid voter index");
int i = nth / 8;
Context.require(i < VOTES_BYTES_LENGTH, "Invalid bitset access");
return (votes[i] >> (nth % 8) & 1) == 1;
Context.require(votes.length >= i + 1, "Invalid votes index");
return (votes[votes.length - i - 1] >> (nth % 8) & 1) == 1;
}
}
18 changes: 18 additions & 0 deletions bmv/bsc2/src/test/resources/testnet.json

Large diffs are not rendered by default.

0 comments on commit 00c6183

Please sign in to comment.