From f45970a0d5d6a0644d72bd2859ad9ac5b31dcc0a Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Fri, 7 Aug 2020 00:54:58 +0200 Subject: [PATCH] Fix FeeCap estimation Signed-off-by: Jakub Sztandera --- chain/messagepool/selection.go | 14 +++++++++++--- node/impl/full/gas.go | 3 +-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/chain/messagepool/selection.go b/chain/messagepool/selection.go index ac3fad83b..c2b954a01 100644 --- a/chain/messagepool/selection.go +++ b/chain/messagepool/selection.go @@ -41,9 +41,6 @@ func (mp *MessagePool) SelectMessages(ts *types.TipSet) ([]*types.SignedMessage, func (mp *MessagePool) selectMessages(curTs, ts *types.TipSet) ([]*types.SignedMessage, error) { start := time.Now() - defer func() { - log.Infof("message selection took %s", time.Since(start)) - }() baseFee, err := mp.api.ChainComputeBaseFee(context.TODO(), ts) if err != nil { @@ -56,6 +53,14 @@ func (mp *MessagePool) selectMessages(curTs, ts *types.TipSet) ([]*types.SignedM if err != nil { return nil, err } + if len(pending) == 0 { + return nil, nil + } + + // defer only here so if we have no pending messages we don't spam + defer func() { + log.Infof("message selection took %s", time.Since(start)) + }() // 1. Create a list of dependent message chains with maximal gas reward per limit consumed var chains []*msgChain @@ -70,6 +75,9 @@ func (mp *MessagePool) selectMessages(curTs, ts *types.TipSet) ([]*types.SignedM }) if len(chains) != 0 && chains[0].gasPerf < 0 { log.Warnw("all messages in mpool have negative has performance", "bestGasPerf", chains[0].gasPerf) + //for i, m := range chains[0].msgs { + //log.Warnf("msg %d %+v", i, m.Message) + //} return nil, nil } diff --git a/node/impl/full/gas.go b/node/impl/full/gas.go index 84164437f..ae1e5396a 100644 --- a/node/impl/full/gas.go +++ b/node/impl/full/gas.go @@ -37,8 +37,7 @@ func (a *GasAPI) GasEstimateFeeCap(ctx context.Context, maxqueueblks int64, increaseFactor := math.Pow(1+1/build.BaseFeeMaxChangeDenom, BaseFeeEstimNBlocks) out := types.BigMul(parentBaseFee, types.NewInt(uint64(increaseFactor*(1<<8)))) - out = types.BigDiv(parentBaseFee, types.NewInt(1<<8)) - + out = types.BigDiv(out, types.NewInt(1<<8)) return out, nil }