go-livepeer icon indicating copy to clipboard operation
go-livepeer copied to clipboard

Monitor avg gas price

Open stronk-dev opened this issue 3 months ago • 2 comments

What does this pull request do? Explain your changes. (required) Removes the hardcoded avg gas price, rather track an actual moving average in the GasPriceMonitor

Specific updates (required)

  • Remove hardcoded default
  • Calculate moving average over gas price samples to expose an average gas price
  • Pass actual avg gas price in FaceValue function

How did you test each of these updates (required) Not yet

Does this pull request close any open issues? Related to #3746 and #3744

Checklist:

  • [ ] Read the contribution guide
  • [ ] make runs successfully
  • [ ] All tests in ./test.sh pass
  • [ ] README and other documentation updated
  • [ ] Pending changelog updated

stronk-dev avatar Sep 24 '25 19:09 stronk-dev

this seemed like a reasonably simple avg gas price calculation: each new sample contributes 20% weight, the previous rolling value keeps 80%. of course we could also keep a set of samples or change these weights (or make them configurable, but this feels like something that should just have sane defaults and no-one should really want to touch)

stronk-dev avatar Sep 24 '25 19:09 stronk-dev

Codecov Report

:x: Patch coverage is 82.92683% with 7 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 31.97435%. Comparing base (d8e520a) to head (9a0e4c4). :warning: Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
eth/gaspricemonitor.go 88.57143% 3 Missing and 1 partial :warning:
pm/stub.go 40.00000% 2 Missing and 1 partial :warning:
Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                 @@
##              master       #3752         +/-   ##
===================================================
+ Coverage   31.94444%   31.97435%   +0.02991%     
===================================================
  Files            158         158                 
  Lines          47520       47560         +40     
===================================================
+ Hits           15180       15207         +27     
- Misses         31437       31447         +10     
- Partials         903         906          +3     
Files with missing lines Coverage Δ
pm/recipient.go 88.46154% <100.00000%> (+0.04952%) :arrow_up:
pm/stub.go 56.25000% <40.00000%> (-0.30431%) :arrow_down:
eth/gaspricemonitor.go 85.81081% <88.57143%> (+0.72309%) :arrow_up:

... and 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d8e520a...9a0e4c4. Read the comment docs.

Files with missing lines Coverage Δ
pm/recipient.go 88.46154% <100.00000%> (+0.04952%) :arrow_up:
pm/stub.go 56.25000% <40.00000%> (-0.30431%) :arrow_down:
eth/gaspricemonitor.go 85.81081% <88.57143%> (+0.72309%) :arrow_up:

... and 3 files with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Sep 24 '25 19:09 codecov[bot]