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

Operator signing computing #1206

Merged
merged 6 commits into from
Feb 4, 2025
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
12 changes: 12 additions & 0 deletions core/mock/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ func (t *MockWriter) GetOperatorStakes(ctx context.Context, operatorId core.Oper
func (t *MockWriter) GetOperatorStakesForQuorums(ctx context.Context, quorums []core.QuorumID, blockNumber uint32) (core.OperatorStakes, error) {
args := t.Called()
result := args.Get(0)
if fn, ok := result.(func([]core.QuorumID, uint32) core.OperatorStakes); ok {
return fn(quorums, blockNumber), args.Error(1)
}
return result.(core.OperatorStakes), args.Error(1)
}

Expand Down Expand Up @@ -128,18 +131,27 @@ func (t *MockWriter) OperatorAddressToID(ctx context.Context, address gethcommon
func (t *MockWriter) BatchOperatorIDToAddress(ctx context.Context, operatorIds []core.OperatorID) ([]gethcommon.Address, error) {
args := t.Called()
result := args.Get(0)
if fn, ok := result.(func([]core.OperatorID) []gethcommon.Address); ok {
return fn(operatorIds), args.Error(1)
}
return result.([]gethcommon.Address), args.Error(1)
}

func (t *MockWriter) BatchOperatorAddressToID(ctx context.Context, addresses []gethcommon.Address) ([]core.OperatorID, error) {
args := t.Called()
result := args.Get(0)
if fn, ok := result.(func([]gethcommon.Address) []core.OperatorID); ok {
return fn(addresses), args.Error(1)
}
return result.([]core.OperatorID), args.Error(1)
}

func (t *MockWriter) GetQuorumBitmapForOperatorsAtBlockNumber(ctx context.Context, operatorIds []core.OperatorID, blockNumber uint32) ([]*big.Int, error) {
args := t.Called()
result := args.Get(0)
if fn, ok := result.(func([]core.OperatorID, uint32) []*big.Int); ok {
return fn(operatorIds, blockNumber), args.Error(1)
}
return result.([]*big.Int), args.Error(1)
}

Expand Down
103 changes: 103 additions & 0 deletions disperser/dataapi/docs/v2/V2_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,69 @@ const docTemplateV2 = `{
}
}
},
"/operators/signing-info": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Operators"
],
"summary": "Fetch operators signing info",
"parameters": [
{
"type": "string",
"description": "Fetch operators signing info up to the end time (ISO 8601 format: 2006-01-02T15:04:05Z) [default: now]",
"name": "end",
"in": "query"
},
{
"type": "integer",
"description": "Fetch operators signing info starting from an interval (in seconds) before the end time [default: 3600]",
"name": "interval",
"in": "query"
},
{
"type": "string",
"description": "Comma separated list of quorum IDs to fetch signing info for [default: 0,1]",
"name": "quorums",
"in": "query"
},
{
"type": "boolean",
"description": "Whether to only return operators with signing rate less than 100% [default: false]",
"name": "nonsigner_only",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/v2.OperatorsSigningInfoResponse"
}
},
"400": {
"description": "error: Bad request",
"schema": {
"$ref": "#/definitions/v2.ErrorResponse"
}
},
"404": {
"description": "error: Not found",
"schema": {
"$ref": "#/definitions/v2.ErrorResponse"
}
},
"500": {
"description": "error: Server error",
"schema": {
"$ref": "#/definitions/v2.ErrorResponse"
}
}
}
}
},
"/operators/stake": {
"get": {
"produces": [
Expand Down Expand Up @@ -1270,6 +1333,35 @@ const docTemplateV2 = `{
}
}
},
"v2.OperatorSigningInfo": {
"type": "object",
"properties": {
"operator_address": {
"type": "string"
},
"operator_id": {
"type": "string"
},
"quorum_id": {
"type": "integer"
},
"signing_percentage": {
"type": "number"
},
"stake_percentage": {
"type": "number"
},
"total_batches": {
"type": "integer"
},
"total_responsible_batches": {
"type": "integer"
},
"total_unsigned_batches": {
"type": "integer"
}
}
},
"v2.OperatorStake": {
"type": "object",
"properties": {
Expand All @@ -1287,6 +1379,17 @@ const docTemplateV2 = `{
}
}
},
"v2.OperatorsSigningInfoResponse": {
"type": "object",
"properties": {
"operator_signing_info": {
"type": "array",
"items": {
"$ref": "#/definitions/v2.OperatorSigningInfo"
}
}
}
},
"v2.OperatorsStakeResponse": {
"type": "object",
"properties": {
Expand Down
103 changes: 103 additions & 0 deletions disperser/dataapi/docs/v2/V2_swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,69 @@
}
}
},
"/operators/signing-info": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Operators"
],
"summary": "Fetch operators signing info",
"parameters": [
{
"type": "string",
"description": "Fetch operators signing info up to the end time (ISO 8601 format: 2006-01-02T15:04:05Z) [default: now]",
"name": "end",
"in": "query"
},
{
"type": "integer",
"description": "Fetch operators signing info starting from an interval (in seconds) before the end time [default: 3600]",
"name": "interval",
"in": "query"
},
{
"type": "string",
"description": "Comma separated list of quorum IDs to fetch signing info for [default: 0,1]",
"name": "quorums",
"in": "query"
},
{
"type": "boolean",
"description": "Whether to only return operators with signing rate less than 100% [default: false]",
"name": "nonsigner_only",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/v2.OperatorsSigningInfoResponse"
}
},
"400": {
"description": "error: Bad request",
"schema": {
"$ref": "#/definitions/v2.ErrorResponse"
}
},
"404": {
"description": "error: Not found",
"schema": {
"$ref": "#/definitions/v2.ErrorResponse"
}
},
"500": {
"description": "error: Server error",
"schema": {
"$ref": "#/definitions/v2.ErrorResponse"
}
}
}
}
},
"/operators/stake": {
"get": {
"produces": [
Expand Down Expand Up @@ -1267,6 +1330,35 @@
}
}
},
"v2.OperatorSigningInfo": {
"type": "object",
"properties": {
"operator_address": {
"type": "string"
},
"operator_id": {
"type": "string"
},
"quorum_id": {
"type": "integer"
},
"signing_percentage": {
"type": "number"
},
"stake_percentage": {
"type": "number"
},
"total_batches": {
"type": "integer"
},
"total_responsible_batches": {
"type": "integer"
},
"total_unsigned_batches": {
"type": "integer"
}
}
},
"v2.OperatorStake": {
"type": "object",
"properties": {
Expand All @@ -1284,6 +1376,17 @@
}
}
},
"v2.OperatorsSigningInfoResponse": {
"type": "object",
"properties": {
"operator_signing_info": {
"type": "array",
"items": {
"$ref": "#/definitions/v2.OperatorSigningInfo"
}
}
}
},
"v2.OperatorsStakeResponse": {
"type": "object",
"properties": {
Expand Down
71 changes: 71 additions & 0 deletions disperser/dataapi/docs/v2/V2_swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,25 @@ definitions:
v2_dispersal_status:
type: string
type: object
v2.OperatorSigningInfo:
properties:
operator_address:
type: string
operator_id:
type: string
quorum_id:
type: integer
signing_percentage:
type: number
stake_percentage:
type: number
total_batches:
type: integer
total_responsible_batches:
type: integer
total_unsigned_batches:
type: integer
type: object
v2.OperatorStake:
properties:
operator_id:
Expand All @@ -481,6 +500,13 @@ definitions:
stake_percentage:
type: number
type: object
v2.OperatorsSigningInfoResponse:
properties:
operator_signing_info:
items:
$ref: '#/definitions/v2.OperatorSigningInfo'
type: array
type: object
v2.OperatorsStakeResponse:
properties:
stake_ranked_operators:
Expand Down Expand Up @@ -867,6 +893,51 @@ paths:
summary: Operator node reachability check
tags:
- Operators
/operators/signing-info:
get:
parameters:
- description: 'Fetch operators signing info up to the end time (ISO 8601 format:
2006-01-02T15:04:05Z) [default: now]'
in: query
name: end
type: string
- description: 'Fetch operators signing info starting from an interval (in seconds)
before the end time [default: 3600]'
in: query
name: interval
type: integer
- description: 'Comma separated list of quorum IDs to fetch signing info for
[default: 0,1]'
in: query
name: quorums
type: string
- description: 'Whether to only return operators with signing rate less than
100% [default: false]'
in: query
name: nonsigner_only
type: boolean
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/v2.OperatorsSigningInfoResponse'
"400":
description: 'error: Bad request'
schema:
$ref: '#/definitions/v2.ErrorResponse'
"404":
description: 'error: Not found'
schema:
$ref: '#/definitions/v2.ErrorResponse'
"500":
description: 'error: Server error'
schema:
$ref: '#/definitions/v2.ErrorResponse'
summary: Fetch operators signing info
tags:
- Operators
/operators/stake:
get:
parameters:
Expand Down
Loading
Loading