From cda67ff88ea61eaf9f7c868ee4c92a5c9d4234a9 Mon Sep 17 00:00:00 2001 From: gpsanant Date: Wed, 15 Nov 2023 16:53:54 -0800 Subject: [PATCH] update nonSignerForQuorumIndex outside of loop --- src/BLSSignatureChecker.sol | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/BLSSignatureChecker.sol b/src/BLSSignatureChecker.sol index 86d44680..ee80785e 100644 --- a/src/BLSSignatureChecker.sol +++ b/src/BLSSignatureChecker.sol @@ -132,11 +132,13 @@ contract BLSSignatureChecker is IBLSSignatureChecker { stakeRegistry.getTotalStakeAtBlockNumberFromIndex(quorumNumber, referenceBlockNumber, nonSignerStakesAndSignature.totalStakeIndices[quorumNumberIndex]); // copy total stake to signed stake quorumStakeTotals.signedStakeForQuorum[quorumNumberIndex] = quorumStakeTotals.totalStakeForQuorum[quorumNumberIndex]; + + // keep track of the nonSigners index in the quorum + uint32 nonSignerForQuorumIndex = 0; + // loop through all nonSigners, checking that they are a part of the quorum via their quorumBitmap // if so, load their stake at referenceBlockNumber and subtract it from running stake signed for (uint32 i = 0; i < nonSignerStakesAndSignature.nonSignerPubkeys.length; i++) { - // keep track of the nonSigners index in the quorum - uint32 nonSignerForQuorumIndex = 0; // if the nonSigner is a part of the quorum, subtract their stake from the running total if (BitmapUtils.numberIsInBitmap(nonSignerQuorumBitmaps[i], quorumNumber)) { quorumStakeTotals.signedStakeForQuorum[quorumNumberIndex] -=