@@ -2,7 +2,6 @@ package chainio
22
33import (
44 "context"
5-
65 "github.com/Layr-Labs/eigensdk-go/chainio/clients"
76 "github.com/Layr-Labs/eigensdk-go/chainio/clients/avsregistry"
87 "github.com/Layr-Labs/eigensdk-go/chainio/clients/eth"
@@ -88,13 +87,22 @@ func (w *AvsWriter) SendTask(context context.Context, batchMerkleRoot [32]byte,
8887
8988func (w * AvsWriter ) SendAggregatedResponse (ctx context.Context , batchMerkleRoot [32 ]byte , nonSignerStakesAndSignature servicemanager.IBLSSignatureCheckerNonSignerStakesAndSignature ) (* gethtypes.Receipt , error ) {
9089 txOpts := w .Signer .GetTxOpts ()
91- txOpts .GasLimit = 500_000 // TODO(juli): This is a temporary fix to avoid out of gas errors. Goethereum is underestimating the gas limit for this tx.
90+ txOpts .NoSend = true // simulate the transaction
9291 tx , err := w .AvsContractBindings .ServiceManager .RespondToTask (txOpts , batchMerkleRoot , nonSignerStakesAndSignature )
9392 if err != nil {
9493 w .logger .Error ("Error submitting SubmitTaskResponse tx while calling respondToTask" , "err" , err )
9594 return nil , err
9695 }
9796
97+ // Send the transaction
98+ txOpts .NoSend = false
99+ txOpts .GasLimit = tx .Gas () * 110 / 100 // Add 10% to the gas limit
100+ tx , err = w .AvsContractBindings .ServiceManager .RespondToTask (txOpts , batchMerkleRoot , nonSignerStakesAndSignature )
101+ if err != nil {
102+ w .logger .Error ("Error submitting SubmitTaskResponse tx while calling respondToTask" , "err" , err )
103+ return nil , err
104+ }
105+
98106 receipt , err := utils .WaitForTransactionReceipt (w .Client , ctx , tx .Hash ())
99107 if err != nil {
100108 return nil , err
0 commit comments