sync: enforce message gas limits

This commit is contained in:
Łukasz Magiera 2020-05-13 03:36:56 +02:00
parent d124d10f7c
commit 4c64f0ca11
3 changed files with 5 additions and 5 deletions

View File

@ -114,6 +114,7 @@ const BlsSignatureCacheSize = 40000
// TODO: If this is gonna stay, it should move to specs-actors // TODO: If this is gonna stay, it should move to specs-actors
const BlockMessageLimit = 512 const BlockMessageLimit = 512
const BlockGasLimit = 100_000_000
var DrandCoeffs = []string{ var DrandCoeffs = []string{
"82c279cce744450e68de98ee08f9698a01dd38f8e3be3c53f2b840fb9d09ad62a0b6b87981e179e1b14bc9a2d284c985", "82c279cce744450e68de98ee08f9698a01dd38f8e3be3c53f2b840fb9d09ad62a0b6b87981e179e1b14bc9a2d284c985",

View File

@ -873,10 +873,9 @@ func (syncer *Syncer) checkBlockMessages(ctx context.Context, b *types.FullBlock
return xerrors.New("'GasPrice' field cannot be negative") return xerrors.New("'GasPrice' field cannot be negative")
} }
// TODO: This should be a thing if m.GasLimit > build.BlockGasLimit {
//if m.GasLimit > BLOCK_GAS_LIMIT { return xerrors.New("'GasLimit' field cannot be greater than a block's gas limit")
// return xerrors.New("'GasLimit' field cannot be greater than a block's gas limit") }
//}
// 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 < vm.PricelistByEpoch(baseTs.Height()).OnChainMessage(m.ChainLength()) { if m.GasLimit < vm.PricelistByEpoch(baseTs.Height()).OnChainMessage(m.ChainLength()) {

View File

@ -568,7 +568,7 @@ func configureStorageMiner(ctx context.Context, api lapi.FullNode, addr address.
Params: enc, Params: enc,
Value: types.NewInt(0), Value: types.NewInt(0),
GasPrice: gasPrice, GasPrice: gasPrice,
GasLimit: 100000000, GasLimit: 99999999,
} }
smsg, err := api.MpoolPushMessage(ctx, msg) smsg, err := api.MpoolPushMessage(ctx, msg)