From 114c0ea85c0497a62286f59ab0fc68e21b6f4c48 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Fri, 4 Sep 2020 15:42:12 +0200 Subject: [PATCH] Fix GasPremium capping logic Cap it just to FeeCap, there is no reason to cap it proportionally Signed-off-by: Jakub Sztandera --- node/impl/full/gas.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/node/impl/full/gas.go b/node/impl/full/gas.go index d0fae9afc..778c2c4eb 100644 --- a/node/impl/full/gas.go +++ b/node/impl/full/gas.go @@ -217,16 +217,11 @@ func capGasFee(msg *types.Message, maxFee abi.TokenAmount) { gl := types.NewInt(uint64(msg.GasLimit)) totalFee := types.BigMul(msg.GasFeeCap, gl) - minerFee := types.BigMul(msg.GasPremium, gl) if totalFee.LessThanEqual(maxFee) { 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.GasPremium = big.Div(big.Div(big.Mul(minerFee, maxFee), totalFee), gl) + msg.GasPremium = big.Min(msg.GasFeeCap, msg.GasPremium) // cap premium at FeeCap }