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][Stage1] Deregistered operators endpt for LameDuck Operators #152

Merged

Conversation

siddimore
Copy link
Contributor

@siddimore siddimore commented Dec 27, 2023

Why are these changes needed?

Definition LameDuckOperator: Operator who was deregistered recently past 14 days as an example. Even if the Operator is DeRegistered their is responsibility to be available for the blobs they signed before DeRegisteration.
If that operator is offline, but is in the 14 day window they are termed as LameDuck Operator

  1. Define Endpoint for DeRegisteredOperators Info
  2. Create specific handler for Querying DeRegistered Operator in given time window
  3. Update SubgraphClient to Get DeRegistered Operators in given time window
  4. Check Operators returned by SubgraphClient to see if they are online
  5. Create DeRegisteredMetadataResponse based on the result of Operator Online check

Sample Query

Query: GET "/v1/operatorsInfo/deregisteredOperators/?days=14"
Response: {"meta":{"size":2},"data":[{"operator_id":"0xe22dae12a0074f20b8fc96a0489376db34075e545ef60c4845d264a732568311","block_number":22,"ip_address":"localhost:32007","is_online":false},{"operator_id":"0xe23cae12a0074f20b8fc96a0489376db34075e545ef60c4845d264b732568312","block_number":24,"ip_address":"localhost:32009","is_online":true}]}

Stages

[Stage1][Current]: Implementation to query and check if DeRegistered Operators are online or not. A very simple check and provide a list
[Stage2]: Implementation to follow with block timestamp for last signed batch and possibly stats on how many days was operator offline for in the 14 day window.

Checks

  • I've made sure the lint is passing in this PR.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(

@siddimore siddimore requested a review from jianoaix December 27, 2023 19:20
disperser/dataapi/server.go Outdated Show resolved Hide resolved
disperser/dataapi/server.go Outdated Show resolved Hide resolved
disperser/dataapi/server.go Outdated Show resolved Hide resolved
disperser/dataapi/server.go Outdated Show resolved Hide resolved
@siddimore siddimore requested a review from QuinnLee January 16, 2024 19:43
@siddimore siddimore marked this pull request as ready for review January 19, 2024 23:32
@siddimore siddimore marked this pull request as draft January 19, 2024 23:33
@siddimore siddimore changed the title [DataApi] Deregistered operators endpt [DataApi] Deregistered operators endpt for LameDuck Operators Jan 20, 2024
@siddimore siddimore marked this pull request as ready for review January 21, 2024 00:06
Copy link
Contributor

@jianoaix jianoaix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to generate swagger docs for this interface

disperser/dataapi/operatorsInfo_handlers.go Outdated Show resolved Hide resolved
disperser/dataapi/operatorsInfo_handlers.go Outdated Show resolved Hide resolved
disperser/dataapi/server.go Outdated Show resolved Hide resolved
disperser/dataapi/operatorsInfo_handlers.go Outdated Show resolved Hide resolved
disperser/dataapi/server.go Outdated Show resolved Hide resolved
@siddimore siddimore changed the title [DataApi] Deregistered operators endpt for LameDuck Operators [DataApi][Stage1] Deregistered operators endpt for LameDuck Operators Jan 22, 2024
@siddimore
Copy link
Contributor Author

Note: Would like to merge this PR, if i can get an approval

@siddimore
Copy link
Contributor Author

You may want to generate swagger docs for this interface

done

Copy link
Contributor

@dmanc dmanc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, would be nice to put an example of the output in the description of the PR.

disperser/dataapi/server.go Outdated Show resolved Hide resolved
@siddimore
Copy link
Contributor Author

lgtm, would be nice to put an example of the output in the description of the PR.

added

disperser/dataapi/operatorsInfo_handlers.go Outdated Show resolved Hide resolved
disperser/dataapi/operatorsInfo_handlers.go Outdated Show resolved Hide resolved
disperser/dataapi/operatorsInfo_handlers.go Outdated Show resolved Hide resolved
disperser/dataapi/docs/swagger.yaml Outdated Show resolved Hide resolved
disperser/dataapi/operatorsInfo_handlers.go Outdated Show resolved Hide resolved
disperser/dataapi/operatorsInfo_handlers.go Outdated Show resolved Hide resolved
disperser/dataapi/operatorsInfo_handlers.go Outdated Show resolved Hide resolved
disperser/dataapi/subgraph_client.go Outdated Show resolved Hide resolved
@siddimore siddimore merged commit c80b0cd into Layr-Labs:master Feb 7, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants