@@ -123,23 +123,19 @@ func NewAvsWriterFromConfig(baseConfig *config.BaseConfig, ecdsaConfig *config.E
123123// SendAggregatedResponse continuously sends a RespondToTask transaction until it is included in the blockchain.
124124// This function:
125125// 1. Simulates the transaction to calculate the nonce and initial gas price without broadcasting it.
126- // 2. Repeatedly attempts to send the transaction, bumping the gas price after `timeToWaitBeforeBump` has passed.
127- // 3. Monitors for the receipt of previously sent transactions or checks the state to confirm if the response
128- // has already been processed (e.g., by another transaction).
129- // 4. Validates that the aggregator and batcher have sufficient balance to cover transaction costs before sending.
126+ // 2. Validates that the aggregator and batcher have sufficient balance to cover transaction costs before sending.
127+ // 3. Repeatedly attempts to send the transaction via GeometricTxManager, bumping the gas price after `txn_confirmation_timeout` has passed.
130128//
131129// Returns:
132130// - A transaction receipt if the transaction is successfully included in the blockchain.
133- // - If no receipt is found, but the batch state indicates the response has already been processed, it exits
134- // without an error (returning `nil, nil`).
135131// - An error if the process encounters a fatal issue (e.g., permanent failure in verifying balances or state).
136132func (w * AvsWriter ) SendAggregatedResponse (batchIdentifierHash [32 ]byte , batchMerkleRoot [32 ]byte , senderAddress [20 ]byte , nonSignerStakesAndSignature servicemanager.IBLSSignatureCheckerNonSignerStakesAndSignature ) (* types.Receipt , error ) {
137133 txOpts , err := w .TxManager .GetNoSendTxOpts ()
138134 if err != nil {
139135 w .logger .Errorf ("Failed to get transaction options: %v" , err )
140136 return nil , err
141137 }
142- // This is used to simulate the transaction and get the transaction ready for sending
138+ // Note: txOpts is set to simulate the tx. This is to make sure it won't revert and get the transaction ready for sending.
143139 tx , err := w .RespondToTaskV2Retryable (txOpts , batchMerkleRoot , senderAddress , nonSignerStakesAndSignature , retry .SendToChainRetryParams ())
144140 if err != nil {
145141 w .logger .Errorf ("Failed to simulate transaction: %v" , err )
@@ -164,7 +160,7 @@ func (w *AvsWriter) SendAggregatedResponse(batchIdentifierHash [32]byte, batchMe
164160 return nil , err
165161 }
166162 w .logger .Infof ("RespondToTask transaction (%v) sent for MerkleRoot %v. %+v" , tx .Hash ().Hex (), batchMerkleRootHashString , receipt )
167- w .updateAggregatorGasCostMetrics (receipt , batchIdentifierHash ) // At this point receipt is not nil, so we can safely update the metrics
163+ w .updateAggregatorGasCostMetrics (receipt , batchIdentifierHash )
168164 return receipt , nil
169165 }
170166 return retry .RetryWithData (respondToTaskV2Func , retry .RespondToTaskV2 ())
0 commit comments