5
5
"context"
6
6
"encoding/json"
7
7
"fmt"
8
+ "strings"
8
9
9
10
"github.com/ipfs/go-cid"
10
11
"go.uber.org/multierr"
@@ -460,7 +461,7 @@ func (s *SubmitCommitTask) createCommitMessage(ctx context.Context, maddr addres
460
461
}
461
462
aggMsg , err = s .gasEstimateCommit (ctx , maddr , aggEnc .Bytes (), mi , goodFunds , aggCollateral , maxFee , ts .Key ())
462
463
if err != nil {
463
- return nil , err
464
+ return nil , xerrors . Errorf ( "gas estimate aggregate commit: %w" , err )
464
465
}
465
466
aggGas := big .Mul (big .Add (ts .MinTicketBlock ().ParentBaseFee , aggMsg .GasPremium ), big .NewInt (aggMsg .GasLimit ))
466
467
aggCost = big .Add (aggGas , aggFee )
@@ -474,9 +475,15 @@ func (s *SubmitCommitTask) createCommitMessage(ctx context.Context, maddr addres
474
475
return nil , xerrors .Errorf ("could not serialize commit params: %w" , err )
475
476
}
476
477
msg , err = s .gasEstimateCommit (ctx , maddr , enc .Bytes (), mi , goodFunds , collateral , maxFee , ts .Key ())
477
- if err != nil {
478
- return nil , err
478
+ if err != nil && ! strings .Contains (err .Error (), "call ran out of gas" ) {
479
+ return nil , xerrors .Errorf ("gas estimate individual commit: %w" , err )
480
+ } else if err != nil && ! aggCost .Nil () {
481
+ log .Errorw ("gas estimate individual commit failed" , "err" , err , "sp" , SpID , "sector" , infos [0 ].Number )
482
+ log .Infow ("Sending commit message with aggregate due to no alternative" , "Batch Cost" , cost , "Aggregate Cost" , aggCost )
483
+ return aggMsg , nil
479
484
}
485
+
486
+ log .Infow ("gas estimate individual commit succeeded" , "sp" , SpID , "sector" , infos [0 ].Number )
480
487
gas := big .Mul (big .Add (ts .MinTicketBlock ().ParentBaseFee , msg .GasPremium ), big .NewInt (msg .GasLimit ))
481
488
cost = gas
482
489
}
0 commit comments