Skip to content

Commit

Permalink
Switched network ID to chain ID on the EC manager
Browse files Browse the repository at this point in the history
  • Loading branch information
jclapis committed May 15, 2024
1 parent d384383 commit bcc1483
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion api/types/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type ClientStatus struct {
IsWorking bool `json:"isWorking"`
IsSynced bool `json:"isSynced"`
SyncProgress float64 `json:"syncProgress"`
NetworkId uint `json:"networkId"`
ChainId uint `json:"networkId"`
Error string `json:"error"`
}

Expand Down
12 changes: 6 additions & 6 deletions node/services/ec-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,11 @@ func (m *ExecutionClientManager) CheckStatus(ctx context.Context) *apitypes.Clie
if status.FallbackEnabled {
status.FallbackClientStatus = checkEcStatus(ctx, m.fallbackEc)
// Check if fallback is using the expected network
if status.FallbackClientStatus.Error == "" && status.FallbackClientStatus.NetworkId != m.expectedChainID {
if status.FallbackClientStatus.Error == "" && status.FallbackClientStatus.ChainId != m.expectedChainID {
m.fallbackReady = false
colorReset := "\033[0m"
colorYellow := "\033[33m"
status.FallbackClientStatus.Error = fmt.Sprintf("The fallback client is using a different chain [%s%s%s, Chain ID %d] than what your node is configured for [%s, Chain ID %d]", colorYellow, getNetworkNameFromId(status.FallbackClientStatus.NetworkId), colorReset, status.FallbackClientStatus.NetworkId, getNetworkNameFromId(m.expectedChainID), m.expectedChainID)
status.FallbackClientStatus.Error = fmt.Sprintf("The fallback client is using a different chain [%s%s%s, Chain ID %d] than what your node is configured for [%s, Chain ID %d]", colorYellow, getNetworkNameFromId(status.FallbackClientStatus.ChainId), colorReset, status.FallbackClientStatus.ChainId, getNetworkNameFromId(m.expectedChainID), m.expectedChainID)
return status
}
}
Expand All @@ -303,17 +303,17 @@ func getNetworkNameFromId(networkId uint) string {
func checkEcStatus(ctx context.Context, client *ethclient.Client) apitypes.ClientStatus {
status := apitypes.ClientStatus{}

// Get the NetworkId
networkId, err := client.NetworkID(ctx)
// Get the Chain ID
chainId, err := client.ChainID(ctx)
if err != nil {
status.Error = fmt.Sprintf("Sync progress check failed with [%s]", err.Error())
status.IsSynced = false
status.IsWorking = false
return status
}

if networkId != nil {
status.NetworkId = uint(networkId.Uint64())
if chainId != nil {
status.ChainId = uint(chainId.Uint64())
}

// Get the fallback's sync progress
Expand Down

0 comments on commit bcc1483

Please sign in to comment.