Merge pull request #10198 from filecoin-project/asr/gas-limit

chain: explicitly check that gasLimit is above zero
This commit is contained in:
Łukasz Magiera 2023-02-07 03:38:58 +01:00 committed by GitHub
commit 8066833b3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -207,6 +207,10 @@ func (m *Message) ValidForBlockInclusion(minGas int64, version network.Version)
return xerrors.Errorf("'GasLimit' field cannot be greater than a block's gas limit (%d > %d)", m.GasLimit, build.BlockGasLimit)
}
if m.GasLimit <= 0 {
return xerrors.Errorf("'GasLimit' field %d must be positive", m.GasLimit)
}
// since prices might vary with time, this is technically semantic validation
if m.GasLimit < minGas {
return xerrors.Errorf("'GasLimit' field cannot be less than the cost of storing a message on chain %d < %d", m.GasLimit, minGas)