Skip to content

Commit

Permalink
Use 55th percentile instead of median for gas-price
Browse files Browse the repository at this point in the history
The aim is to put some negative pressure on gas-premium instead of
maintining status quo.

55th percentile instead of median should not make much difference for
block inclusion timing.

Signed-off-by: Jakub Sztandera <[email protected]>
  • Loading branch information
Jakub Sztandera authored and bibibong committed Feb 4, 2021
1 parent 206483b commit 98e9f64
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion node/impl/full/gas.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,15 @@ type gasMeta struct {
limit int64
}

// finds 55th percntile instead of median to put negative pressure on gas price
func medianGasPremium(prices []gasMeta, blocks int) abi.TokenAmount {
sort.Slice(prices, func(i, j int) bool {
// sort desc by price
return prices[i].price.GreaterThan(prices[j].price)
})

at := build.BlockGasTarget * int64(blocks) / 2
at := build.BlockGasTarget * int64(blocks) / 2 // 50th
at += build.BlockGasTarget * int64(blocks) / (2 * 20) // move 5% further
prev1, prev2 := big.Zero(), big.Zero()
for _, price := range prices {
prev1, prev2 = price.price, prev1
Expand Down

0 comments on commit 98e9f64

Please sign in to comment.