Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Given a day of the voting date find the hour that maximizes the probability that the upgrade happens during working hours #12204

Merged
merged 25 commits into from
Oct 28, 2024

Conversation

stedfn
Copy link
Contributor

@stedfn stedfn commented Oct 10, 2024

Usage:

python3 estimate_epoch_start_time.py --chain_id mainnet --voting_date_day "2024-10-23" --timezone cet

Example Output
Epoch -1: 13 hours, 19 minutes
Epoch -2: 13 hours, 15 minutes
Epoch -3: 13 hours, 23 minutes
Epoch -4: 13 hours, 17 minutes

Exponential weighted average epoch length: 13 hours, 18 minutes
Predicted start of epoch 1: 2024-10-22 05:18:32 CEST+0200 Tuesday
Predicted start of epoch 2: 2024-10-22 18:37:26 CEST+0200 Tuesday
Predicted start of epoch 3: 2024-10-23 07:56:19 CEST+0200 Wednesday
Predicted start of epoch 4: 2024-10-23 21:15:12 CEST+0200 Wednesday
Predicted start of epoch 5: 2024-10-24 10:34:05 CEST+0200 Thursday
Predicted start of epoch 6: 2024-10-24 23:52:58 CEST+0200 Thursday
Predicted start of epoch 7: 2024-10-25 13:11:51 CEST+0200 Friday
Predicted start of epoch 8: 2024-10-26 02:30:45 CEST+0200 Saturday
Predicted start of epoch 9: 2024-10-26 15:49:38 CEST+0200 Saturday
Predicted start of epoch 10: 2024-10-27 04:08:31 CET+0100 Sunday

Voting hours on 2024-10-23 UTC that result in upgrade during working hours (UTC 8:00-22:00):
- 00:00, Upgrade Epoch: 4
- 01:00, Upgrade Epoch: 4
- 02:00, Upgrade Epoch: 4
- 03:00, Upgrade Epoch: 4
- 04:00, Upgrade Epoch: 4
- 05:00, Upgrade Epoch: 4
- 06:00, Upgrade Epoch: 5
- 07:00, Upgrade Epoch: 5
- 08:00, Upgrade Epoch: 5
- 09:00, Upgrade Epoch: 5
- 10:00, Upgrade Epoch: 5
- 11:00, Upgrade Epoch: 5
- 12:00, Upgrade Epoch: 5
- 13:00, Upgrade Epoch: 5
- 14:00, Upgrade Epoch: 5
- 15:00, Upgrade Epoch: 5
- 16:00, Upgrade Epoch: 5
- 17:00, Upgrade Epoch: 5
- 18:00, Upgrade Epoch: 5
- 19:00, Upgrade Epoch: 5

@stedfn stedfn self-assigned this Oct 10, 2024
Copy link

codecov bot commented Oct 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.59%. Comparing base (8be015e) to head (7bc1d6d).
Report is 67 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12204      +/-   ##
==========================================
- Coverage   71.84%   71.59%   -0.26%     
==========================================
  Files         827      836       +9     
  Lines      166716   167470     +754     
  Branches   166716   167470     +754     
==========================================
+ Hits       119783   119899     +116     
- Misses      41718    42339     +621     
- Partials     5215     5232      +17     
Flag Coverage Δ
backward-compatibility 0.16% <ø> (-0.01%) ⬇️
db-migration 0.16% <ø> (-0.01%) ⬇️
genesis-check 1.25% <ø> (-0.01%) ⬇️
integration-tests 38.83% <ø> (-0.10%) ⬇️
linux 71.23% <ø> (-0.29%) ⬇️
linux-nightly 71.17% <ø> (-0.25%) ⬇️
macos 54.25% <ø> (-0.28%) ⬇️
pytests 1.56% <ø> (-0.01%) ⬇️
sanity-checks 1.37% <ø> (-0.01%) ⬇️
unittests 65.36% <ø> (-0.29%) ⬇️
upgradability 0.21% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Base automatically changed from stefan/feat/predict_upgrade_time to master October 15, 2024 13:01
@stedfn stedfn marked this pull request as ready for review October 15, 2024 13:59
@stedfn stedfn requested a review from a team as a code owner October 15, 2024 13:59
@stedfn stedfn requested a review from wacban October 15, 2024 13:59
@stedfn stedfn removed the request for review from wacban October 15, 2024 13:59
@stedfn stedfn requested a review from VanBarbascu October 21, 2024 15:39
Copy link
Contributor

@VanBarbascu VanBarbascu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for taking the time to work on this!

@stedfn stedfn added this pull request to the merge queue Oct 28, 2024
Merged via the queue into master with commit 3f3a078 Oct 28, 2024
29 checks passed
@stedfn stedfn deleted the stefan/feat/working_hour branch October 28, 2024 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants