Fix FeeCap estimation

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-08-07 00:54:58 +02:00
parent 2b2b632cd6
commit f45970a0d5
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA
2 changed files with 12 additions and 5 deletions

View File

@ -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
}

View File

@ -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
}