Merge pull request #10198 from filecoin-project/asr/gas-limit
chain: explicitly check that gasLimit is above zero
This commit is contained in:
commit
8066833b3a
@ -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)
|
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
|
// since prices might vary with time, this is technically semantic validation
|
||||||
if m.GasLimit < minGas {
|
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)
|
return xerrors.Errorf("'GasLimit' field cannot be less than the cost of storing a message on chain %d < %d", m.GasLimit, minGas)
|
||||||
|
Loading…
Reference in New Issue
Block a user