Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions handlers/epochs.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func buildEpochsPageData(firstEpoch uint64, pageSize uint64) (*models.EpochsPage
pageData.UrlParams["count"] = fmt.Sprintf("%v", pageData.PageSize)
pageData.MaxEpoch = uint64(currentEpoch)

specs := chainState.GetSpecs()
finalizedEpoch, _ := chainState.GetFinalizedCheckpoint()
justifiedEpoch, _ := chainState.GetJustifiedCheckpoint()
epochLimit := pageSize
Expand Down Expand Up @@ -150,6 +151,10 @@ func buildEpochsPageData(firstEpoch uint64, pageSize uint64) (*models.EpochsPage
epochData.HeadVoteParticipation = float64(dbEpoch.VotedHead) * 100.0 / float64(dbEpoch.Eligible)
epochData.TotalVoteParticipation = float64(dbEpoch.VotedTotal) * 100.0 / float64(dbEpoch.Eligible)
}
epochData.SlotsPerEpoch = specs.SlotsPerEpoch
if specs.SlotsPerEpoch > 0 {
epochData.ProposalParticipation = float64(dbEpoch.BlockCount) * 100.0 / float64(specs.SlotsPerEpoch)
}
epochData.EthTransactionCount = dbEpoch.EthTransactionCount
epochData.BlobCount = dbEpoch.BlobCount
} else {
Expand Down
15 changes: 12 additions & 3 deletions templates/epochs/epochs.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ <h1 class="h4 mb-1 mb-md-0">
<th>Txs / Blobs</th>
<th>Finalized</th>
<th class="d-none d-md-table-cell">Eligible</th>
<th class="d-none d-lg-table-cell">Proposals</th>
<th>Target Vote</th>
<th class="d-none d-lg-table-cell">Head Vote</th>
<th class="d-none d-lg-table-cell">Total Vote</th>
Expand Down Expand Up @@ -90,25 +91,33 @@ <h1 class="h4 mb-1 mb-md-0">
{{ end }}
</td>
<td class="d-none d-md-table-cell">{{ formatEthAddCommasFromGwei $epoch.EligibleEther }}</td>
<td class="d-none d-lg-table-cell">
<div style="position:relative;width:inherit;height:inherit;">
{{ formatFloat $epoch.ProposalParticipation 1 }}% <small class="text-muted">({{ $epoch.CanonicalBlockCount }}/{{ $epoch.SlotsPerEpoch }})</small>
<div class="progress" style="position:absolute;bottom:-6px;width:100%;height:4px;">
<div class="progress-bar" role="progressbar" style="width: {{ formatFloat $epoch.ProposalParticipation 1 }}%;" aria-valuenow="{{ formatFloat $epoch.ProposalParticipation 1 }}%" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</td>
<td>
<div style="position:relative;width:inherit;height:inherit;">
{{ formatEthAddCommasFromGwei $epoch.TargetVoted }} <small class="text-muted ml-3">({{ formatFloat $epoch.TargetVoteParticipation 2 }}%)</small>
Comment thread
pk910 marked this conversation as resolved.
{{ formatFloat $epoch.TargetVoteParticipation 2 }}% <small class="text-muted">({{ formatEthAddCommasFromGwei $epoch.TargetVoted }})</small>
<div class="progress" style="position:absolute;bottom:-6px;width:100%;height:4px;">
<div class="progress-bar" role="progressbar" style="width: {{ formatFloat $epoch.TargetVoteParticipation 2 }}%;" aria-valuenow="{{ formatFloat $epoch.TargetVoteParticipation 2 }}%" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</td>
<td class="d-none d-lg-table-cell">
<div style="position:relative;width:inherit;height:inherit;">
{{ formatEthAddCommasFromGwei $epoch.HeadVoted }} <small class="text-muted ml-3">({{ formatFloat $epoch.HeadVoteParticipation 2 }}%)</small>
{{ formatFloat $epoch.HeadVoteParticipation 2 }}% <small class="text-muted">({{ formatEthAddCommasFromGwei $epoch.HeadVoted }})</small>
<div class="progress" style="position:absolute;bottom:-6px;width:100%;height:4px;">
<div class="progress-bar" role="progressbar" style="width: {{ formatFloat $epoch.HeadVoteParticipation 2 }}%;" aria-valuenow="{{ formatFloat $epoch.HeadVoteParticipation 2 }}%" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</td>
<td class="d-none d-lg-table-cell">
<div style="position:relative;width:inherit;height:inherit;">
{{ formatEthAddCommasFromGwei $epoch.TotalVoted }} <small class="text-muted ml-3">({{ formatFloat $epoch.TotalVoteParticipation 2 }}%)</small>
{{ formatFloat $epoch.TotalVoteParticipation 2 }}% <small class="text-muted">({{ formatEthAddCommasFromGwei $epoch.TotalVoted }})</small>
<div class="progress" style="position:absolute;bottom:-6px;width:100%;height:4px;">
<div class="progress-bar" role="progressbar" style="width: {{ formatFloat $epoch.TotalVoteParticipation 2 }}%;" aria-valuenow="{{ formatFloat $epoch.TotalVoteParticipation 2 }}%" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions types/models/epochs.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ type EpochsPageDataEpoch struct {
TargetVoteParticipation float64 `json:"target_vote_participation"`
HeadVoteParticipation float64 `json:"head_vote_participation"`
TotalVoteParticipation float64 `json:"total_vote_participation"`
SlotsPerEpoch uint64 `json:"slots_per_epoch"`
ProposalParticipation float64 `json:"proposal_participation"`
EthTransactionCount uint64 `json:"eth_transaction_count"`
BlobCount uint64 `json:"blob_count"`
}