Skip to content

Commit

Permalink
#79: fix data race for blsagg
Browse files Browse the repository at this point in the history
  • Loading branch information
chzyer committed Jun 21, 2024
1 parent 1ac246a commit 8142dcd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion services/bls_aggregation/blsagg.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ func (a *BlsAggregatorService) singleTaskAggregatorGoroutineFunc(
signersApkG2: bls.NewZeroG2Point().Add(operatorsAvsStateDict[signedTaskResponseDigest.OperatorId].OperatorInfo.Pubkeys.G2Pubkey),
signersAggSigG1: signedTaskResponseDigest.BlsSignature,
signersOperatorIdsSet: map[types.OperatorId]bool{signedTaskResponseDigest.OperatorId: true},
signersTotalStakePerQuorum: operatorsAvsStateDict[signedTaskResponseDigest.OperatorId].StakePerQuorum,
signersTotalStakePerQuorum: cloneStakePerQuorumMap(operatorsAvsStateDict[signedTaskResponseDigest.OperatorId].StakePerQuorum),
}
} else {
digestAggregatedOperators.signersAggSigG1.Add(signedTaskResponseDigest.BlsSignature)
Expand Down Expand Up @@ -462,3 +462,11 @@ func checkIfStakeThresholdsMet(
}
return true
}

func cloneStakePerQuorumMap(stakes map[types.QuorumNum]types.StakeAmount) map[types.QuorumNum]types.StakeAmount {
out := make(map[types.QuorumNum]types.StakeAmount, len(stakes))
for k, v := range stakes {
out[k] = new(big.Int).Set(v)
}
return out
}

0 comments on commit 8142dcd

Please sign in to comment.