Skip to content

Commit

Permalink
Merge pull request #245 from ethpandaops/fix-peerdas-enr-cgc
Browse files Browse the repository at this point in the history
fix: rename peerDAS related csc field to cgc
  • Loading branch information
skylenet authored Feb 12, 2025
2 parents 455fe5d + 68042c9 commit adb0f7d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions handlers/clients_cl.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func buildCLClientsPageData() (*models.ClientsCLPageData, time.Duration) {
PeerDASInfos: &models.ClientCLPagePeerDAS{
Warnings: models.ClientCLPageDataPeerDASWarnings{
MissingENRsPeers: []string{},
MissingCSCFromENRPeers: []string{},
MissingCGCFromENRPeers: []string{},
EmptyColumns: []uint64{},
},
},
Expand Down Expand Up @@ -416,15 +416,15 @@ func buildCLClientsPageData() (*models.ClientsCLPageData, time.Duration) {

custodySubnetCount := pageData.PeerDASInfos.CustodyRequirement

if cscHex, ok := enrValues["csc"]; ok {
val, err := strconv.ParseUint(cscHex.(string), 0, 64)
if cgcHex, ok := enrValues["cgc"]; ok {
val, err := strconv.ParseUint(cgcHex.(string), 0, 64)
if err != nil {
logrus.WithFields(logrus.Fields{"node": v.Alias, "peer_id": v.PeerID, "csc": cscHex.(string)}).Error("failed to decode csc. ", err)
logrus.WithFields(logrus.Fields{"node": v.Alias, "peer_id": v.PeerID, "cgc": cgcHex.(string)}).Error("failed to decode cgc. ", err)
} else {
custodySubnetCount = val
}
} else {
pageData.PeerDASInfos.Warnings.MissingCSCFromENRPeers = append(pageData.PeerDASInfos.Warnings.MissingCSCFromENRPeers, v.PeerID)
pageData.PeerDASInfos.Warnings.MissingCGCFromENRPeers = append(pageData.PeerDASInfos.Warnings.MissingCGCFromENRPeers, v.PeerID)
pageData.PeerDASInfos.Warnings.HasWarnings = true
}

Expand All @@ -450,7 +450,7 @@ func buildCLClientsPageData() (*models.ClientsCLPageData, time.Duration) {
peerDASInfo := models.ClientCLPageDataNodePeerDAS{
Columns: resColumns,
Subnets: resSubnets,
CSC: custodySubnetCount,
CGC: custodySubnetCount,
IsSuperNode: uint64(len(resColumns)) == pageData.PeerDASInfos.NumberOfColumns,
}
v.PeerDAS = &peerDASInfo
Expand Down
18 changes: 9 additions & 9 deletions templates/clients/clients_cl.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ <h5 class="modal-title" id="peerDasWarningsModal">👀 PeerDAS: Some problems we
</ul>
<hr/>
{{ end }}
{{ if gt (len $root.PeerDASInfos.Warnings.MissingCSCFromENRPeers) 0 }}
<p><b><i class="fa-solid fa-triangle-exclamation text-warning"></i> Missing <code>csc</code> field in ENR on {{ len $root.PeerDASInfos.Warnings.MissingCSCFromENRPeers}} nodes:</b></p>
{{ if gt (len $root.PeerDASInfos.Warnings.MissingCGCFromENRPeers) 0 }}
<p><b><i class="fa-solid fa-triangle-exclamation text-warning"></i> Missing <code>cgc</code> field in ENR on {{ len $root.PeerDASInfos.Warnings.MissingCGCFromENRPeers}} nodes:</b></p>
<p>
Calculating the right columns for these peers might not be be possible due to the missing `csc` field.
Calculating the right columns for these peers might not be be possible due to the missing `cgc` field.
The default custody requirement of <code>{{ $root.PeerDASInfos.CustodyRequirement}}</code> will be used for these nodes.
</p>
<ul>
{{ range $i, $p := $root.PeerDASInfos.Warnings.MissingCSCFromENRPeers }}
{{ range $i, $p := $root.PeerDASInfos.Warnings.MissingCGCFromENRPeers }}
<li>
<code class="peerdetails-modal-peer" onclick="showPeerDetailsModal('{{ $p }}')">{{ $p }}</code>
{{ $peer := index $root.Nodes $p}}
Expand Down Expand Up @@ -284,7 +284,7 @@ <h5 class="modal-title" id="peerDasWarningsModal">👀 PeerDAS: Some problems we
<tr class="collapse peerInfo" style="transition:0s" id="peerInfo-{{ $client.PeerID }}">
<td colspan="7" style="padding: 10px 0;" class="client-node-peerinfo-container" data-peerid="{{ $client.PeerID }}">


</td>
</tr>
{{ end }}
Expand Down Expand Up @@ -533,8 +533,8 @@ <h5 class="modal-title" style="overflow-wrap: anywhere;">
<td><code data-bind="text: peer_das().is_super_node"></code></td>
</tr>
<tr>
<td>CSC</td>
<td><code data-bind="text: peer_das().csc"></code></td>
<td>CGC</td>
<td><code data-bind="text: peer_das().cgc"></code></td>
</tr>
<tr>
<td>Columns</td>
Expand All @@ -548,7 +548,7 @@ <h5 class="modal-title" style="overflow-wrap: anywhere;">
<tr>
<td colspan="2" style="font-weight: 700;padding-top: 5px;padding-bottom: 5px; text-align: center;border-top:1px dashed; border-bottom:1px dashed">Peers</td>
</tr>

{{ html "<!-- ko if: peers_in != null -->" }}
{{ html "<!-- ko foreach: peers_in -->" }}
<tr>
Expand All @@ -567,7 +567,7 @@ <h5 class="modal-title" style="overflow-wrap: anywhere;">
</tr>
{{ html "<!-- /ko -->" }}
{{ html "<!-- /ko -->" }}

{{ html "<!-- ko if: peers_out != null -->" }}
{{ html "<!-- ko foreach: peers_out -->" }}
<tr>
Expand Down
8 changes: 4 additions & 4 deletions types/models/clients_cl.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ type ClientCLPageDataPeerDASWarnings struct {
// MissingENRs indicates that the client is missing ENRs for some peers
MissingENRs bool `json:"missing_enrs"`
MissingENRsPeers []string `json:"missing_enrs_peers"`
// MissingCSCFromENR indicates that the client is missing the CSC from the ENR for some peers
MissingCSCFromENR bool `json:"missing_csc_from_enr"`
MissingCSCFromENRPeers []string `json:"missing_csc_from_enr_peers"`
// MissingCGCFromENR indicates that the client is missing the CGC from the ENR for some peers
MissingCGCFromENR bool `json:"missing_cgc_from_enr"`
MissingCGCFromENRPeers []string `json:"missing_cgc_from_enr_peers"`
// MissingSpecValues indicates that wer were unable to parse the spec values, thus using defaults
MissingSpecValues bool `json:"missing_spec_values"`
// MissingPeersOnColum
Expand Down Expand Up @@ -115,7 +115,7 @@ type ClientCLPageDataNodeENRValue struct {
}

type ClientCLPageDataNodePeerDAS struct {
CSC uint64 `json:"csc"`
CGC uint64 `json:"cgc"`
Columns []uint64 `json:"columns"`
Subnets []uint64 `json:"subnets"`
IsSuperNode bool `json:"is_super_node"`
Expand Down

0 comments on commit adb0f7d

Please sign in to comment.