From 044202b37f77677b5b725ab2b721c70593a6e3a6 Mon Sep 17 00:00:00 2001 From: vyzo Date: Fri, 11 Sep 2020 17:11:57 +0300 Subject: [PATCH] use conservative base fee lower bound factor for strict checks --- chain/messagepool/messagepool.go | 5 +++-- chain/messagepool/pruning.go | 2 +- chain/messagepool/repub.go | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/chain/messagepool/messagepool.go b/chain/messagepool/messagepool.go index 033d30059..03584d275 100644 --- a/chain/messagepool/messagepool.go +++ b/chain/messagepool/messagepool.go @@ -52,6 +52,7 @@ var RepublishInterval = time.Duration(10*build.BlockDelaySecs+build.PropagationD var minimumBaseFee = types.NewInt(uint64(build.MinimumBaseFee)) var baseFeeLowerBoundFactor = types.NewInt(10) +var baseFeeLowerBoundFactorConservative = types.NewInt(100) var MaxActorPendingMessages = 1000 @@ -442,7 +443,7 @@ func (mp *MessagePool) verifyMsgBeforeAdd(m *types.SignedMessage, curTs *types.T publish := local if len(curTs.Blocks()) > 0 { baseFee := curTs.Blocks()[0].ParentBaseFee - baseFeeLowerBound := getBaseFeeLowerBound(baseFee) + baseFeeLowerBound := getBaseFeeLowerBound(baseFee, baseFeeLowerBoundFactorConservative) if m.Message.GasFeeCap.LessThan(baseFeeLowerBound) { if local { log.Warnf("local message will not be immediately published because GasFeeCap doesn't meet the lower bound for inclusion in the next 20 blocks (GasFeeCap: %s, baseFeeLowerBound: %s)", @@ -1340,7 +1341,7 @@ func (mp *MessagePool) Clear(local bool) { } } -func getBaseFeeLowerBound(baseFee types.BigInt) types.BigInt { +func getBaseFeeLowerBound(baseFee, factor types.BigInt) types.BigInt { baseFeeLowerBound := types.BigDiv(baseFee, baseFeeLowerBoundFactor) if baseFeeLowerBound.LessThan(minimumBaseFee) { baseFeeLowerBound = minimumBaseFee diff --git a/chain/messagepool/pruning.go b/chain/messagepool/pruning.go index fd8199b89..d0e53795a 100644 --- a/chain/messagepool/pruning.go +++ b/chain/messagepool/pruning.go @@ -46,7 +46,7 @@ func (mp *MessagePool) pruneMessages(ctx context.Context, ts *types.TipSet) erro if err != nil { return xerrors.Errorf("computing basefee: %w", err) } - baseFeeLowerBound := getBaseFeeLowerBound(baseFee) + baseFeeLowerBound := getBaseFeeLowerBound(baseFee, baseFeeLowerBoundFactor) pending, _ := mp.getPendingMessages(ts, ts) diff --git a/chain/messagepool/repub.go b/chain/messagepool/repub.go index 375360bce..db31e18c2 100644 --- a/chain/messagepool/repub.go +++ b/chain/messagepool/repub.go @@ -28,7 +28,7 @@ func (mp *MessagePool) republishPendingMessages() error { mp.curTsLk.Unlock() return xerrors.Errorf("computing basefee: %w", err) } - baseFeeLowerBound := getBaseFeeLowerBound(baseFee) + baseFeeLowerBound := getBaseFeeLowerBound(baseFee, baseFeeLowerBoundFactor) pending := make(map[address.Address]map[uint64]*types.SignedMessage) mp.lk.Lock()