diff --git a/packages/arb-rpc-node/web3/eth.go b/packages/arb-rpc-node/web3/eth.go index d39fd88bc9..01ce27b55d 100644 --- a/packages/arb-rpc-node/web3/eth.go +++ b/packages/arb-rpc-node/web3/eth.go @@ -39,9 +39,15 @@ import ( "github.com/offchainlabs/arbitrum/packages/arb-util/machine" ) -var gasPriceFactor = big.NewInt(2) +var gasPriceFactorNum = big.NewInt(5) +var gasPriceFactorDenom = big.NewInt(4) var gasEstimationCushion = 10 +func applyGasPriceBidFactor(price *big.Int) *big.Int { + adjustedPrice := new(big.Int).Mul(price, gasPriceFactorNum) + return adjustedPrice.Div(adjustedPrice, gasPriceFactorDenom) +} + const maxGas = 1<<31 - 1 type ServerConfig struct { @@ -96,7 +102,7 @@ func (s *Server) GasPrice() (*hexutil.Big, error) { if err != nil { return nil, err } - return (*hexutil.Big)(new(big.Int).Mul(prices[5], gasPriceFactor)), nil + return (*hexutil.Big)(applyGasPriceBidFactor(prices[5])), nil } func (s *Server) Accounts() []common.Address { @@ -285,7 +291,7 @@ func (s *Server) EstimateGas(args CallTxArgs) (hexutil.Uint64, error) { if res.FeeStats.Price.L2Computation.Cmp(big.NewInt(0)) == 0 { return hexutil.Uint64(res.GasUsed.Uint64() + 10000), nil } else { - extraCalldataUnits := (len(res.FeeStats.GasUsed().Bytes()) + len(new(big.Int).Mul(res.FeeStats.Price.L2Computation, gasPriceFactor).Bytes()) + gasEstimationCushion) * 16 + extraCalldataUnits := (len(res.FeeStats.GasUsed().Bytes()) + len(applyGasPriceBidFactor(res.FeeStats.Price.L2Computation).Bytes()) + gasEstimationCushion) * 16 // Adjust calldata units used for calldata from gas limit res.FeeStats.UnitsUsed.L1Calldata = res.FeeStats.UnitsUsed.L1Calldata.Add(res.FeeStats.UnitsUsed.L1Calldata, big.NewInt(int64(extraCalldataUnits))) used := res.FeeStats.TargetGasUsed() diff --git a/packages/arb-rpc-node/web3/nodeInterface.go b/packages/arb-rpc-node/web3/nodeInterface.go index eef052374d..fb1213a5e5 100644 --- a/packages/arb-rpc-node/web3/nodeInterface.go +++ b/packages/arb-rpc-node/web3/nodeInterface.go @@ -142,6 +142,6 @@ func handleEstimateRetryableTicket(srv *Server, calldata []byte, blockNum rpc.Bl used = used.Div(used, big.NewInt(10)) return estimateRetryableTicket.Outputs.PackValues([]interface{}{ new(big.Int).Add(used, big.NewInt(100)), - new(big.Int).Mul(res.GasPrice, gasPriceFactor), + applyGasPriceBidFactor(res.GasPrice), }) }