Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DataApi] Handle Deregisterd operator errors #260

Merged
merged 8 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
39 changes: 36 additions & 3 deletions disperser/dataapi/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,17 +353,20 @@ const docTemplate = `{
"type": "object",
"properties": {
"commitment": {
"$ref": "#/definitions/core.Commitment"
siddimore marked this conversation as resolved.
Show resolved Hide resolved
"$ref": "#/definitions/core.G1Commitment"
},
"length": {
"type": "integer"
},
"length_commitment": {
"$ref": "#/definitions/core.G2Commitment"
},
"length_proof": {
"$ref": "#/definitions/core.Commitment"
"$ref": "#/definitions/core.LengthProof"
}
}
},
"core.Commitment": {
"core.G1Commitment": {
"type": "object",
"properties": {
"x": {
Expand All @@ -374,6 +377,22 @@ const docTemplate = `{
}
}
},
"core.G2Commitment": {
"type": "object",
"properties": {
"x": {
"$ref": "#/definitions/github_com_consensys_gnark-crypto_ecc_bn254_internal_fptower.E2"
}
}
},
"core.LengthProof": {
"type": "object",
"properties": {
"x": {
"$ref": "#/definitions/github_com_consensys_gnark-crypto_ecc_bn254_internal_fptower.E2"
}
}
},
"core.SecurityParam": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -473,6 +492,9 @@ const docTemplate = `{
"operator_id": {
"type": "string"
},
"operator_process_error": {
"type": "string"
},
"socket": {
"type": "string"
}
Expand Down Expand Up @@ -591,6 +613,17 @@ const docTemplate = `{
"Finalized",
"InsufficientSignatures"
]
},
"github_com_consensys_gnark-crypto_ecc_bn254_internal_fptower.E2": {
"type": "object",
"properties": {
"a0": {
"type": "array",
"items": {
"type": "integer"
}
}
}
}
}
}`
Expand Down
39 changes: 36 additions & 3 deletions disperser/dataapi/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -349,17 +349,20 @@
"type": "object",
"properties": {
"commitment": {
"$ref": "#/definitions/core.Commitment"
"$ref": "#/definitions/core.G1Commitment"
},
"length": {
"type": "integer"
},
"length_commitment": {
"$ref": "#/definitions/core.G2Commitment"
},
"length_proof": {
"$ref": "#/definitions/core.Commitment"
"$ref": "#/definitions/core.LengthProof"
}
}
},
"core.Commitment": {
"core.G1Commitment": {
"type": "object",
"properties": {
"x": {
Expand All @@ -370,6 +373,22 @@
}
}
},
"core.G2Commitment": {
"type": "object",
"properties": {
"x": {
"$ref": "#/definitions/github_com_consensys_gnark-crypto_ecc_bn254_internal_fptower.E2"
}
}
},
"core.LengthProof": {
"type": "object",
"properties": {
"x": {
"$ref": "#/definitions/github_com_consensys_gnark-crypto_ecc_bn254_internal_fptower.E2"
}
}
},
"core.SecurityParam": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -469,6 +488,9 @@
"operator_id": {
"type": "string"
},
"operator_process_error": {
"type": "string"
},
"socket": {
"type": "string"
}
Expand Down Expand Up @@ -587,6 +609,17 @@
"Finalized",
"InsufficientSignatures"
]
},
"github_com_consensys_gnark-crypto_ecc_bn254_internal_fptower.E2": {
"type": "object",
"properties": {
"a0": {
"type": "array",
"items": {
"type": "integer"
}
}
}
}
}
}
27 changes: 24 additions & 3 deletions disperser/dataapi/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,31 @@ definitions:
encoding.BlobCommitments:
properties:
commitment:
$ref: '#/definitions/core.Commitment'
$ref: '#/definitions/core.G1Commitment'
length:
type: integer
length_commitment:
$ref: '#/definitions/core.G2Commitment'
length_proof:
$ref: '#/definitions/core.Commitment'
$ref: '#/definitions/core.LengthProof'
type: object
core.Commitment:
core.G1Commitment:
properties:
x:
items:
type: integer
type: array
type: object
core.G2Commitment:
properties:
x:
$ref: '#/definitions/github_com_consensys_gnark-crypto_ecc_bn254_internal_fptower.E2'
type: object
core.LengthProof:
properties:
x:
$ref: '#/definitions/github_com_consensys_gnark-crypto_ecc_bn254_internal_fptower.E2'
type: object
core.SecurityParam:
properties:
adversary_threshold:
Expand Down Expand Up @@ -88,6 +100,8 @@ definitions:
type: boolean
operator_id:
type: string
operator_process_error:
type: string
socket:
type: string
type: object
Expand Down Expand Up @@ -167,6 +181,13 @@ definitions:
- Failed
- Finalized
- InsufficientSignatures
github_com_consensys_gnark-crypto_ecc_bn254_internal_fptower.E2:
properties:
a0:
items:
type: integer
type: array
type: object
info:
contact: {}
description: This is the EigenDA Data Access API server.
Expand Down
28 changes: 18 additions & 10 deletions disperser/dataapi/operators_info_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import (
)

type OperatorOnlineStatus struct {
OperatorInfo *Operator
IndexedOperatorInfo *core.IndexedOperatorInfo
OperatorInfo *Operator
IndexedOperatorInfo *core.IndexedOperatorInfo
OperatorProcessError string
}

var (
Expand Down Expand Up @@ -60,8 +61,9 @@ func processOperatorOnlineCheck(deregisteredOperatorState *IndexedDeregisteredOp

for _, operatorInfo := range operators {
operatorStatus := OperatorOnlineStatus{
OperatorInfo: operatorInfo.Metadata,
IndexedOperatorInfo: operatorInfo.IndexedOperatorInfo,
OperatorInfo: operatorInfo.Metadata,
IndexedOperatorInfo: operatorInfo.IndexedOperatorInfo,
OperatorProcessError: operatorInfo.OperatorProcessError,
}

// Submit each operator status check to the worker pool
Expand All @@ -74,8 +76,13 @@ func processOperatorOnlineCheck(deregisteredOperatorState *IndexedDeregisteredOp
}

func checkIsOnlineAndProcessOperator(operatorStatus OperatorOnlineStatus, operatorOnlineStatusresultsChan chan<- *DeregisteredOperatorMetadata, logger common.Logger) {
socket := core.OperatorSocket(operatorStatus.IndexedOperatorInfo.Socket).GetRetrievalSocket()
isOnline := checkIsOperatorOnline(socket)
var isOnline bool
siddimore marked this conversation as resolved.
Show resolved Hide resolved
var socket string
if operatorStatus.IndexedOperatorInfo != nil {
logger.Error("IndexedOperatorInfo is nil for operator %v", operatorStatus.OperatorInfo)
siddimore marked this conversation as resolved.
Show resolved Hide resolved
socket = core.OperatorSocket(operatorStatus.IndexedOperatorInfo.Socket).GetRetrievalSocket()
isOnline = checkIsOperatorOnline(socket)
}

// Log the online status
if isOnline {
Expand All @@ -86,10 +93,11 @@ func checkIsOnlineAndProcessOperator(operatorStatus OperatorOnlineStatus, operat

// Create the metadata regardless of online status
metadata := &DeregisteredOperatorMetadata{
OperatorId: string(operatorStatus.OperatorInfo.OperatorId[:]),
BlockNumber: uint(operatorStatus.OperatorInfo.BlockNumber),
Socket: socket,
IsOnline: isOnline,
OperatorId: string(operatorStatus.OperatorInfo.OperatorId[:]),
BlockNumber: uint(operatorStatus.OperatorInfo.BlockNumber),
Socket: socket,
IsOnline: isOnline,
OperatorProcessError: operatorStatus.OperatorProcessError,
}

// Send the metadata to the results channel
Expand Down
11 changes: 6 additions & 5 deletions disperser/dataapi/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ type (
}

DeregisteredOperatorMetadata struct {
OperatorId string `json:"operator_id"`
BlockNumber uint `json:"block_number"`
Socket string `json:"socket"`
IsOnline bool `json:"is_online"`
OperatorId string `json:"operator_id"`
BlockNumber uint `json:"block_number"`
Socket string `json:"socket"`
IsOnline bool `json:"is_online"`
OperatorProcessError string `json:"operator_process_error"`
}

DeregisteredOperatorsResponse struct {
Expand Down Expand Up @@ -165,7 +166,7 @@ func (s *server) Start() error {
metrics.GET("/throughput", s.FetchMetricsTroughputHandler)
metrics.GET("/non_signers", s.FetchNonSigners)
metrics.GET("/operator_nonsigning_percentage", s.FetchOperatorsNonsigningPercentageHandler)
metrics.GET("/deregistered_operators", s.FetchDeregisteredOperators)
metrics.GET("/deregistered-operators", s.FetchDeregisteredOperators)
siddimore marked this conversation as resolved.
Show resolved Hide resolved
}
swagger := v1.Group("/swagger")
{
Expand Down
Loading
Loading