Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Average block time calculation neglects startHeight #542

Open
michaelfig opened this issue Jul 1, 2021 · 1 comment · May be fixed by #548
Open

Average block time calculation neglects startHeight #542

michaelfig opened this issue Jul 1, 2021 · 1 comment · May be fixed by #548
Assignees
Labels
bug Something isn't working

Comments

@michaelfig
Copy link
Contributor

Describe the bug
For a medium-to-large genesis.json initial_height (reflected in Meteor.settings.params.startHeight), average block time drops suddenly on the second block.

This is tested against big-dipper branch v0.41.x-14.2.

To Reproduce
Steps to reproduce the behavior:

  1. Start bigdipper on a chain with settings.json params.startHeight: 64628, params.defaultBlockTime: 5000 and genesis.json initial_height: "64628"
  2. Notice that "average block height" begins at 5000, but drops near 0 at the next block.
  3. Look in mongodb:
> db.analytics.find()
{ "_id" : "NvHB3YkndzwgR5wcB", "height" : 64629, "precommits" : 119, "averageBlockTime" : 5000, "time" : "2021-07-01T19:00:01.766892137Z", "voting_power" : NaN }
{ "_id" : "4ghFqaYGjG7frrYTN", "height" : 64630, "precommits" : 119, "averageBlockTime" : 0.20611171282686058, "timeDiff" : 11555, "time" : "2021-07-01T19:00:13.321499387Z", "voting_power" : 6671 }
{ "_id" : "3dRft5qPxTiZA9u6Q", "height" : 64631, "precommits" : 119, "averageBlockTime" : 0.3008927604400365, "timeDiff" : 6126, "time" : "2021-07-01T19:00:19.447433509Z", "voting_power" : 6671 }
{ "_id" : "YSxxuQETMFsf22czQ", "height" : 64632, "precommits" : 119, "averageBlockTime" : 0.3948199034533977, "timeDiff" : 6071, "time" : "2021-07-01T19:00:25.518063569Z", "voting_power" : 6671 }
{ "_id" : "Pm8h4ZBYJAKXcN7Yh", "height" : 64633, "precommits" : 119, "averageBlockTime" : 0.4881407330620581, "timeDiff" : 6032, "time" : "2021-07-01T19:00:31.550446712Z", "voting_power" : 6671 }

It appears that the calculation (specifically, of the second row of analytics above), averageBlockTime does not take startHeight into account and is somehow using height directly.

Expected behavior

Average block time would hover around 5-10 seconds.

Screenshots
image

Desktop (please complete the following information):

  • OS: MacOS
  • Browser Brave
  • Version 1.26.67

Smartphone (please complete the following information):
n/a

Additional context
Add any other context about the problem here.

@kwunyeung kwunyeung added the bug Something isn't working label Jul 2, 2021
@kwunyeung
Copy link
Member

@michaelfig Thank you for reporting. I will look into this ASAP.

@MonikaCat MonikaCat linked a pull request Jul 15, 2021 that will close this issue
5 tasks
@MonikaCat MonikaCat self-assigned this Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants