Skip to content

Commit

Permalink
Adjust live ec calc for plot filter hf
Browse files Browse the repository at this point in the history
  • Loading branch information
felixbrucker committed Jun 10, 2024
1 parent e890743 commit 6b52ae0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app/harvester-card/harvester-card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
VersionUpdateInfo
} from '../clients/clients'
import {LocalStorageService} from '../local-storage.service'
import {getPlotFilterShareMultiplier} from '../../consensus/plot-filter-share-multiplier'

const sharesPerDayPerK32 = 10
const k32SizeInGb = 108.837
Expand Down Expand Up @@ -148,8 +149,9 @@ export class HarvesterCardComponent implements OnInit, OnDestroy {
this.averageEc = this.stats.pipe(
map(stats => {
const totalShares = stats.reduce((acc, submissionStat) => acc.plus(submissionStat.shares), new BigNumber(0))
const sharesPerDayPerK32Adjusted = sharesPerDayPerK32 * getPlotFilterShareMultiplier(this.statsService.poolStats?.height)
const ecInGib = totalShares
.dividedBy(sharesPerDayPerK32 * durationInDays(this.historicalStatsDurationProvider.selectedDuration))
.dividedBy(sharesPerDayPerK32Adjusted * durationInDays(this.historicalStatsDurationProvider.selectedDuration))
.multipliedBy(k32SizeInGib)

return new Capacity(ecInGib.toNumber()).toString()
Expand Down
23 changes: 23 additions & 0 deletions src/consensus/plot-filter-share-multiplier.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export function getPlotFilterShareMultiplier(height?: number): number {
if (height === undefined) {
return 1 // Adjust after plot filter halving
}

if (height < 5_496_000) {
return 1
}

if (height < 10_542_000) {
return 2
}

if (height < 15_592_000) {
return 4
}

if (height < 20_643_000) {
return 8
}

return 16
}

0 comments on commit 6b52ae0

Please sign in to comment.