Split precommit batches if gas used exceeds block limit

This commit is contained in:
Shrenuj Bansal
2023-04-10 14:52:39 -04:00
parent da6b565dc1
commit 1e25d7b453
4 changed files with 58 additions and 13 deletions
+3
View File
@@ -384,10 +384,13 @@ func gasEstimateGasLimit(
func (m *GasModule) GasEstimateMessageGas(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec, _ types.TipSetKey) (*types.Message, error) {
if msg.GasLimit == 0 {
gasLimit, err := m.GasEstimateGasLimit(ctx, msg, types.EmptyTSK)
log.Errorf("GasEstimateMessageGas GasLimit: %f", gasLimit)
if err != nil {
return nil, err
}
msg.GasLimit = int64(float64(gasLimit) * m.Mpool.GetConfig().GasLimitOverestimation)
log.Errorf("GasEstimateMessageGas GasLimit: %f, GasLimitWithOverestimation", gasLimit, msg.GasLimit)
// Gas overestimation can cause us to exceed the block gas limit, cap it.
if msg.GasLimit > build.BlockGasLimit {
msg.GasLimit = build.BlockGasLimit