Fix GasPremium capping logic
Cap it just to FeeCap, there is no reason to cap it proportionally Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
a081dc7674
commit
114c0ea85c
@ -217,16 +217,11 @@ func capGasFee(msg *types.Message, maxFee abi.TokenAmount) {
|
|||||||
|
|
||||||
gl := types.NewInt(uint64(msg.GasLimit))
|
gl := types.NewInt(uint64(msg.GasLimit))
|
||||||
totalFee := types.BigMul(msg.GasFeeCap, gl)
|
totalFee := types.BigMul(msg.GasFeeCap, gl)
|
||||||
minerFee := types.BigMul(msg.GasPremium, gl)
|
|
||||||
|
|
||||||
if totalFee.LessThanEqual(maxFee) {
|
if totalFee.LessThanEqual(maxFee) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// scale chain/miner fee down proportionally to fit in our budget
|
|
||||||
// TODO: there are probably smarter things we can do here to optimize
|
|
||||||
// message inclusion latency
|
|
||||||
|
|
||||||
msg.GasFeeCap = big.Div(maxFee, gl)
|
msg.GasFeeCap = big.Div(maxFee, gl)
|
||||||
msg.GasPremium = big.Div(big.Div(big.Mul(minerFee, maxFee), totalFee), gl)
|
msg.GasPremium = big.Min(msg.GasFeeCap, msg.GasPremium) // cap premium at FeeCap
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user