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

node-split: add smeshing identities endpoint to smesher service PoC #6452

Merged
merged 8 commits into from
Nov 18, 2024

Conversation

kacpersaw
Copy link
Contributor

@kacpersaw kacpersaw commented Nov 13, 2024

Description

Created smeshing identities endpoint based on #6266
Added states for post, poet and atxes.

TODO after PoC: state switch validation, better error handling

enum IdentityState {
  UNSPECIFIED = 0;

  WAIT_FOR_ATX_SYNCED = 1;
  RETRYING = 2;

  WAITING_FOR_POET_REGISTRATION_WINDOW = 3;
  POET_CHALLENGE_READY = 4;
  POET_REGISTERED = 5;
  WAIT_FOR_POET_ROUND_END = 6;
  POET_PROOF_RECEIVED = 7;

  GENERATING_POST_PROOF = 8;
  POST_PROOF_READY = 9;

  ATX_READY = 10;
  ATX_BROADCASTED = 11;
}

Example:

{
    "identities": {
        "b2b1821338c55f8611de0b4fcaec2cc2e300564f9bfa3fc83ff35d836ad88223": {
            "history": [
                {
                    "state": "WAIT_FOR_POET_ROUND_END",
                    "publishEpoch": 77740,
                    "message": "",
                    "time": "2024-11-18T12:39:18.167152672Z"
                },
                {
                    "state": "POET_REGISTERED",
                    "publishEpoch": 77740,
                    "message": "",
                    "time": "2024-11-18T12:39:18.166982255Z"
                },
                {
                    "state": "POET_CHALLENGE_READY",
                    "publishEpoch": 77740,
                    "message": "",
                    "time": "2024-11-18T12:39:18.062514880Z"
                },
                {
                    "state": "WAITING_FOR_POET_REGISTRATION_WINDOW",
                    "publishEpoch": 77740,
                    "message": "",
                    "time": "2024-11-18T12:39:06.867833166Z"
                },
                {
                    "state": "ATX_BROADCASTED",
                    "publishEpoch": 77739,
                    "message": "",
                    "time": "2024-11-18T12:39:06.866455333Z"
                },
                {
                    "state": "ATX_READY",
                    "publishEpoch": 77739,
                    "message": "",
                    "time": "2024-11-18T12:39:06.627786833Z"
                },
                {
                    "state": "POST_PROOF_READY",
                    "publishEpoch": 77739,
                    "message": "",
                    "time": "2024-11-18T12:39:06.624626Z"
                },
                {
                    "state": "GENERATING_POST_PROOF",
                    "publishEpoch": 77739,
                    "message": "",
                    "time": "2024-11-18T12:39:01.653280386Z"
                },
                {
                    "state": "POET_PROOF_RECEIVED",
                    "publishEpoch": 77739,
                    "message": "",
                    "time": "2024-11-18T12:39:01.653109053Z"
                },
                {
                    "state": "WAIT_FOR_POET_ROUND_END",
                    "publishEpoch": 77739,
                    "message": "",
                    "time": "2024-11-18T12:38:18.146128505Z"
                },
                {
                    "state": "POET_REGISTERED",
                    "publishEpoch": 77739,
                    "message": "",
                    "time": "2024-11-18T12:38:18.145764047Z"
                },
                {
                    "state": "POET_CHALLENGE_READY",
                    "publishEpoch": 77739,
                    "message": "",
                    "time": "2024-11-18T12:38:18.032435630Z"
                },
                {
                    "state": "WAITING_FOR_POET_REGISTRATION_WINDOW",
                    "publishEpoch": 77739,
                    "message": "",
                    "time": "2024-11-18T12:38:16.890825463Z"
                },
                {
                    "state": "WAIT_FOR_ATX_SYNCED",
                    "message": "",
                    "time": "2024-11-18T12:38:15.427747587Z"
                }
            ]
        }
    }
}

Copy link

codecov bot commented Nov 13, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 70 lines in your changes missing coverage. Please review.

Project coverage is 78.0%. Comparing base (a473494) to head (5e802e9).
Report is 12 commits behind head on node-split-poc.

Files with missing lines Patch % Lines
activation/identity_states.go 27.8% 43 Missing and 1 partial ⚠️
api/grpcserver/v2alpha1/smeshing_identities.go 25.0% 24 Missing ⚠️
activation/activation.go 89.4% 2 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           node-split-poc   #6452     +/-   ##
================================================
- Coverage            78.0%   78.0%   -0.1%     
================================================
  Files                 337     339      +2     
  Lines               44937   45070    +133     
================================================
+ Hits                35078   35173     +95     
- Misses               7780    7824     +44     
+ Partials             2079    2073      -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

activation/activation.go Outdated Show resolved Hide resolved
activation/activation.go Outdated Show resolved Hide resolved
activation/identity_states.go Outdated Show resolved Hide resolved
activation/identity_states.go Outdated Show resolved Hide resolved
Comment on lines 111 to 113
if len(s.identities[id].History) > 100 {
s.identities[id].History = s.identities[id].History[1:]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to use something like a ring buffer to avoid reallocating the slice repeatedly (when the append below exceeds the capacity).

node/node.go Outdated Show resolved Hide resolved
@kacpersaw kacpersaw merged commit 79c0bd5 into node-split-poc Nov 18, 2024
15 of 16 checks passed
@kacpersaw kacpersaw deleted the node-split-smesher-states-poc branch November 18, 2024 13:18
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.

2 participants