zeta-chain / node

ZetaChain’s blockchain node and an observer validator client
https://zetachain.com
MIT License
164 stars 105 forks source link

`zetacore` : Use median value for gas price instead of index #2683

Open kingpinXD opened 2 months ago

kingpinXD commented 2 months ago

We currently use median index for gas prices. This makes the calculation for median in case of even length arrays incorrect. We should instead move to using a median value which is calculated based on the length of the array

Ref : https://gosamples.dev/calculate-median/

kingpinXD commented 2 months ago

Original issue image

kingpinXD commented 2 months ago

I don’t think it is a big concern,

This would need quite a bit of change as the gas prices are used in a lot of places in the code . Unless we can think of an exploit , we should keep this at the lowest priority