Fix FeeCap estimation
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
2b2b632cd6
commit
f45970a0d5
@ -41,9 +41,6 @@ func (mp *MessagePool) SelectMessages(ts *types.TipSet) ([]*types.SignedMessage,
|
|||||||
|
|
||||||
func (mp *MessagePool) selectMessages(curTs, ts *types.TipSet) ([]*types.SignedMessage, error) {
|
func (mp *MessagePool) selectMessages(curTs, ts *types.TipSet) ([]*types.SignedMessage, error) {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
defer func() {
|
|
||||||
log.Infof("message selection took %s", time.Since(start))
|
|
||||||
}()
|
|
||||||
|
|
||||||
baseFee, err := mp.api.ChainComputeBaseFee(context.TODO(), ts)
|
baseFee, err := mp.api.ChainComputeBaseFee(context.TODO(), ts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -56,6 +53,14 @@ func (mp *MessagePool) selectMessages(curTs, ts *types.TipSet) ([]*types.SignedM
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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
|
// 1. Create a list of dependent message chains with maximal gas reward per limit consumed
|
||||||
var chains []*msgChain
|
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 {
|
if len(chains) != 0 && chains[0].gasPerf < 0 {
|
||||||
log.Warnw("all messages in mpool have negative has performance", "bestGasPerf", chains[0].gasPerf)
|
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
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,8 +37,7 @@ func (a *GasAPI) GasEstimateFeeCap(ctx context.Context, maxqueueblks int64,
|
|||||||
increaseFactor := math.Pow(1+1/build.BaseFeeMaxChangeDenom, BaseFeeEstimNBlocks)
|
increaseFactor := math.Pow(1+1/build.BaseFeeMaxChangeDenom, BaseFeeEstimNBlocks)
|
||||||
|
|
||||||
out := types.BigMul(parentBaseFee, types.NewInt(uint64(increaseFactor*(1<<8))))
|
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
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user