Skip to content

Commit

Permalink
#79: fix data race for blsagg (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
chzyer committed Jun 24, 2024
1 parent edeaeb1 commit 68ca900
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 @@ -291,7 +291,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 @@ -464,3 +464,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 68ca900

Please sign in to comment.