node
node copied to clipboard
`zetacore` : Use median value for gas price instead of index
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/
Original issue
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