node icon indicating copy to clipboard operation
node copied to clipboard

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

Open kingpinXD opened this issue 1 year ago • 2 comments

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 avatar Aug 12 '24 16:08 kingpinXD

Original issue image

kingpinXD avatar Aug 12 '24 16:08 kingpinXD

I don’t think it is a big concern,

  • The chances of the even index being a lot lower than the actual index are almost negligible.
  • We have a mechanism to update gas prices , if the cctx is pending for too long

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

kingpinXD avatar Aug 13 '24 17:08 kingpinXD