Skip to content

Commit

Permalink
fix data race
Browse files Browse the repository at this point in the history
  • Loading branch information
chzyer committed Jun 26, 2024
1 parent 50454df commit 312b677
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ func (agg *Aggregator) sendAggregatedResponseToContract(ctx context.Context, tas

tx, err := agg.multiProverContract.ConfirmState(agg.transactOpt, *task.state.Task.ToAbi(), nonSignerStakesAndSignature)
if err != nil {
return logex.Trace(err)
return logex.Trace(bindings.MultiProverError(err))
}
logex.Pretty(task.state.Task)
logex.Infof("confirm state: %v", tx.Hash())
Expand Down
10 changes: 9 additions & 1 deletion aggregator/blsagg.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (a *BlsAggregatorService) singleTaskAggregatorGoroutineFunc(
signersApkG2: bls.NewZeroG2Point().Add(operatorsAvsStateDict[signedTaskResponseDigest.OperatorId].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 @@ -461,3 +461,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
}
11 changes: 11 additions & 0 deletions scripts/avs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash -e

. $(dirname $0)/env.sh

function add_whitelist() {
MULTI_PROVER_SERVICE_MANAGER=$(_get_key $AVS_DEPLOY .multiProverServiceManager) \
DEPLOY_KEY_SUFFIX=DEPLOY_KEY \
_script script/Whitelist.s.sol --sig 'add(address)' $1
}

"$@"
2 changes: 1 addition & 1 deletion scripts/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ echo "RPC_URL: $(_get_env RPC_URL)"
echo "=============================================================="
echo

AVS_DEPLOY=contracts/script/output/avs_deploy_output.json
AVS_DEPLOY=contracts/script/output/avs_deploy_$ENV.json
TEE_DEPLOY=contracts/script/output/tee_deploy_output_$ENV.json
EIGENLAYER_DEPLOY=contracts/script/output/eigenlayer_holesky_deploy.json
PRIVATE_KEY=$(_get_env DEPLOY_KEY)
Expand Down

0 comments on commit 312b677

Please sign in to comment.