This repository has been archived by the owner on Dec 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 245
Updated Average Block Time #548
Open
MonikaCat
wants to merge
10
commits into
master
Choose a base branch
from
monika/average-block-time-calculation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8500aee
Update chainId path
MonikaCat 65f90b1
Updated average block time calculations
MonikaCat 82077ba
Code cleanup
MonikaCat d02b2b6
Update ChainStatus label
MonikaCat 2522cea
Add CHANGELOG
MonikaCat cb332dd
Add calculate average block time from startHeight height set in params
MonikaCat f490871
Updated CHANGELOG.md
MonikaCat caf2013
Added genesisTime and rm defaultBlockTime in default_settings.json
MonikaCat d5d628e
Update averageBlockTime calulations
MonikaCat e031cbf
Updated CHANGELOG.md
MonikaCat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MonikaCat can you explain the whole logic here?
In the original implementation,
averageBlcokTime
=lastBlockTime
-genesisTime
/blockHeight
. This is always true for the idea of average block time.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the genesis time value had been removed from the settings.json file, we cannot calculate the average block time by using
averageBlockTime = lastBlockTime - genesisTime / blockHeight
. To handle the calculations, I initially added averageBlockTimeWindow in settings.json file to calculate the average block time of last n blocks...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, I changed the approach and I've just updated the code to calculate average block time starting from the startHeight height set in params in settings.json file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah... I have missed the
genesisTime
in thedefault_settings.json
. It should be there as this is how the average block time is being calculated. Querying from chain is not feasible as the genesis could be huge. The size oncosmoshub-4
can't even give a full response if we query from the api.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see! Alright I will update the code to include
genesisTime
calculations again.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, how does it do now?