-
Notifications
You must be signed in to change notification settings - Fork 94
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
Fetch block time from chain #1384
Conversation
Visit the preview URL for this PR (updated for commit 56fc92c): https://astar-apps--pr1384-fix-block-time-gqakk6p2.web.app (expires Mon, 23 Sep 2024 11:02:13 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: dd76fe72958fe2910fef9d53f0b4539b82b849db |
const secsOneYear = 365 * 24 * 60 * 60; | ||
const periodLength = | ||
eraLength.standardErasPerBuildAndEarnPeriod + eraLength.standardErasPerVotingPeriod; | ||
|
||
const eraPerCycle = periodLength * eraLength.periodsPerCycle; | ||
const blocksStandardEraLength = eraLength.standardEraLength; | ||
const blockPerCycle = blocksStandardEraLength * eraPerCycle; | ||
const cyclePerYear = secsOneYear / secBlockProductionRate / blockPerCycle; | ||
const cyclePerYear = secsOneYear / blockTimeInSeconds / blockPerCycle; | ||
console.log('cyclePerYear', cyclePerYear); |
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.
Log left on purpose?
src/store/general/state.ts
Outdated
@@ -111,6 +112,7 @@ function state(): GeneralStateInterface { | |||
currentBlock: 0, | |||
activeInflationConfiguration: undefined, | |||
inflationParameters: undefined, | |||
blockTimeInSeconds: 12, |
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.
This is default?
Can it be uninitialised until fetched from 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.
It can :)
* Remove Age of Chronos promotion (#1386) * Fetch block time from chain (#1384) * Fetch block time to store * Apr calculation fix * Type fix * PR comments fix and code cleanup * Fix/selected dapp index (#1387) * Voting wizard search bug fix * Keep selected dApps while switching categories * APR calculation fix to use block time for a given block (#1389) * APR calculation fix to use block time for a given block * Small fix
* Remove Age of Chronos promotion (#1386) * Fetch block time from chain (#1384) * Fetch block time to store * Apr calculation fix * Type fix * PR comments fix and code cleanup * Fix/selected dapp index (#1387) * Voting wizard search bug fix * Keep selected dApps while switching categories * APR calculation fix to use block time for a given block (#1389) * APR calculation fix to use block time for a given block * Small fix * Fix for re-staking on unregistered dApps (#1392)
Pull Request Summary
Check list