@@ -3,10 +3,11 @@ package pkg
33import (
44 "context"
55 "encoding/hex"
6- gethtypes "github.com/ethereum/go-ethereum/core/types"
76 "sync"
87 "time"
98
9+ gethtypes "github.com/ethereum/go-ethereum/core/types"
10+
1011 "github.com/prometheus/client_golang/prometheus"
1112 "github.com/yetanotherco/aligned_layer/metrics"
1213
@@ -215,7 +216,6 @@ func (agg *Aggregator) handleBlsAggServiceResponse(blsAggServiceResp blsagg.BlsA
215216 agg .logger .Info ("Threshold reached" , "taskIndex" , blsAggServiceResp .TaskIndex ,
216217 "merkleRoot" , hex .EncodeToString (batchMerkleRoot [:]))
217218
218-
219219 currentBlock , err := agg .AggregatorConfig .BaseConfig .EthRpcClient .BlockNumber (context .Background ())
220220 if err != nil {
221221 agg .logger .Error ("Error getting current block number" , "err" , err )
@@ -251,8 +251,10 @@ func (agg *Aggregator) handleBlsAggServiceResponse(blsAggServiceResp blsagg.BlsA
251251 "merkleRoot" , hex .EncodeToString (batchMerkleRoot [:]))
252252
253253 for i := 0 ; i < MaxSentTxRetries ; i ++ {
254- _ , err = agg .sendAggregatedResponse (batchMerkleRoot , nonSignerStakesAndSignature )
254+ receipt , err : = agg .sendAggregatedResponse (batchMerkleRoot , nonSignerStakesAndSignature )
255255 if err == nil {
256+ agg .logger .Info ("Gas cost used to send aggregated response" , "gasUsed" , receipt .GasUsed )
257+
256258 agg .logger .Info ("Aggregator successfully responded to task" ,
257259 "taskIndex" , blsAggServiceResp .TaskIndex ,
258260 "merkleRoot" , hex .EncodeToString (batchMerkleRoot [:]))
@@ -270,10 +272,8 @@ func (agg *Aggregator) handleBlsAggServiceResponse(blsAggServiceResp blsagg.BlsA
270272 "merkleRoot" , hex .EncodeToString (batchMerkleRoot [:]))
271273}
272274
273-
274-
275- /// Sends response to contract and waits for transaction receipt
276- /// Returns error if it fails to send tx or receipt is not found
275+ // / Sends response to contract and waits for transaction receipt
276+ // / Returns error if it fails to send tx or receipt is not found
277277func (agg * Aggregator ) sendAggregatedResponse (batchMerkleRoot [32 ]byte , nonSignerStakesAndSignature servicemanager.IBLSSignatureCheckerNonSignerStakesAndSignature ) (* gethtypes.Receipt , error ) {
278278 agg .walletMutex .Lock ()
279279 agg .logger .Infof ("- Locked Wallet Resources: Sending aggregated response for batch %s" , hex .EncodeToString (batchMerkleRoot [:]))
@@ -299,7 +299,6 @@ func (agg *Aggregator) sendAggregatedResponse(batchMerkleRoot [32]byte, nonSigne
299299 return receipt , nil
300300}
301301
302-
303302func (agg * Aggregator ) AddNewTask (batchMerkleRoot [32 ]byte , taskCreatedBlock uint32 ) {
304303 agg .AggregatorConfig .BaseConfig .Logger .Info ("Adding new task" ,
305304 "Batch merkle root" , hex .EncodeToString (batchMerkleRoot [:]))
0 commit comments