From 1d8c8b9a8eade341a13cb103c661031f89aa03d2 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Tue, 12 May 2020 22:36:43 -0700 Subject: [PATCH] check gas limits on messages more places --- chain/messagepool/messagepool.go | 4 ++++ miner/miner.go | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/chain/messagepool/messagepool.go b/chain/messagepool/messagepool.go index 96f8e0232..379f12227 100644 --- a/chain/messagepool/messagepool.go +++ b/chain/messagepool/messagepool.go @@ -374,6 +374,10 @@ func (mp *MessagePool) addLocked(m *types.SignedMessage) error { mp.blsSigCache.Add(m.Cid(), m.Signature) } + if m.Message.GasLimit > build.BlockGasLimit { + return xerrors.Errorf("given message has too high of a gas limit") + } + if _, err := mp.api.PutMessage(m); err != nil { log.Warnf("mpooladd cs.PutMessage failed: %s", err) return err diff --git a/miner/miner.go b/miner/miner.go index 4d0a84ccf..9ae5ec43e 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -421,6 +421,12 @@ func SelectMessages(ctx context.Context, al ActorLookup, ts *types.TipSet, msgs for _, msg := range msgs { + // TODO: this should be in some more general 'validate message' call + if msg.Message.GasLimit > build.BlockGasLimit { + log.Warnf("message in mempool had too high of a gas limit (%d)", msg.Message.GasLimit) + continue + } + if msg.Message.To == address.Undef { log.Warnf("message in mempool had bad 'To' address") continue