Skip to content

Commit

Permalink
show 'unknown' as validator when duties are not loaded yet (holesky p…
Browse files Browse the repository at this point in the history
…reparation)
  • Loading branch information
pk910 committed Sep 3, 2023
1 parent b662c33 commit 533f479
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions handlers/slot.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"math"
"net/http"
"strconv"
"strings"
Expand Down Expand Up @@ -219,7 +220,10 @@ func buildSlotPageData(blockSlot int64, blockRoot []byte) (*models.SlotPageData,
if assignments != nil {
pageData.Proposer = assignments.ProposerAssignments[slot]
pageData.ProposerName = services.GlobalBeaconService.GetValidatorName(pageData.Proposer)
} else {
pageData.Proposer = math.MaxInt64
}

} else {
if blockData.Orphaned {
pageData.Status = uint16(models.SlotStatusOrphaned)
Expand Down
5 changes: 5 additions & 0 deletions services/beaconservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package services

import (
"encoding/json"
"math"
"sort"
"strings"
"sync"
Expand Down Expand Up @@ -330,6 +331,10 @@ func (bs *BeaconService) GetProposerAssignments(firstEpoch uint64, lastEpoch uin
for slot, vidx := range epochStats.GetProposerAssignments() {
proposerAssignments[slot] = vidx
}
} else {
for idx := uint64(0); idx < utils.Config.Chain.Config.SlotsPerEpoch; idx++ {
proposerAssignments[(epoch*utils.Config.Chain.Config.SlotsPerEpoch)+idx] = math.MaxInt64
}
}
}
if epoch <= lastEpoch {
Expand Down
2 changes: 1 addition & 1 deletion templates/index/recentSlots.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ <h5 class="card-title d-flex justify-content-between align-items-center" style="
{{ end }}
</td>
<td data-timer="{{ $slot.Ts.Unix }}"><span data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="{{ $slot.Ts }}">{{ formatRecentTimeShort $slot.Ts }}</span></td>
<td>{{ formatValidator $slot.Proposer $slot.ProposerName }}</td>
<td>{{ if gt $slot.Slot 0 }}{{ formatValidator $slot.Proposer $slot.ProposerName }}{{ end }}</td>
</tr>
{{ end }}
</tbody>
Expand Down

0 comments on commit 533f479

Please sign in to comment.