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

Average block time calculation neglects startHeight #542

Open
@michaelfig

Description

@michaelfig

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions