-
Notifications
You must be signed in to change notification settings - Fork 7
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
Feat: epoch monitoring #41
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… add support for relayer status update
xadahiya
approved these changes
Aug 21, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving since new changes are deployed on one of the Staging instances and have been working without any issues.
Suggested improvements are also incorporated in the latest commits.
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #40
Checklist
Current behaviour
There are no APIs that expose the processing status of a snapshot according to the state transitions it goes through before being finalized.
For more details, refer #40
New expected behaviour
The changes included in this PR capture the state transitions as detailed in #40 as per the following data models as an epoch is released until
SnapshotFinalized
event is received by the processor distributor for the specific epoch.EPOCH_RELEASED
Redis key being set:
pooler/snapshotter/utils/redis/redis_keys.py
Lines 90 to 91 in bcc245d
pooler/snapshotter/processor_distributor.py
Lines 649 to 652 in bcc245d
It contains the UNIX timestamp at which the
EpochReleased
event was received from the protocol state contract.For each of the state IDs corresponding to a state transition, except
EPOCH_RELEASED
, a Redis hashtable entry is set against every project ID or type being processed by the snapshotter. The key of this hashtable is in the following formatpooler/snapshotter/utils/redis/redis_keys.py
Lines 94 to 95 in bcc245d
and each value against a hashtable entry of a project ID follows the data model:
pooler/snapshotter/utils/models/data_models.py
Lines 48 to 52 in bcc245d
PRELOAD
For every project type's preloader specifications, the status of all the preloading dependencies being satisfied is captured here:
pooler/snapshotter/processor_distributor.py
Lines 227 to 251 in bcc245d
SNAPSHOT_BUILD
The snapshot builders as configured in
projects.json
are executed. Also refer to the case study of the current implementation of Pooler for a detailed look at snapshot building for base as well as aggregates.pooler/snapshotter/utils/snapshot_worker.py
Lines 100 to 120 in bcc245d
SNAPSHOT_SUBMIT_PAYLOAD_COMMIT
Captures the status of propagation of the built snapshot to the payload commit service in Audit Protocol for further submission to the protocol state contract.
pooler/snapshotter/utils/generic_worker.py
Lines 166 to 195 in bcc245d
SNAPSHOT_SUBMIT_PROTOCOL_CONTRACT
The snapshot submission transaction from the relayer to the protocol state smart contract was successful and a
SnapshotSubmitted
event was generatedpooler/snapshotter/processor_distributor.py
Lines 655 to 668 in bcc245d
SNAPSHOT_FINALIZE
Captures the finalized snapshot accepted against an epoch via a
SnapshotFinalized
event.pooler/snapshotter/processor_distributor.py
Lines 475 to 482 in bcc245d
Core API ([core_api.py](https://github.com/PowerLoom/pooler/blob/bcc245d228acce504ba803b9b50fd89c8eb05984/snapshotter/core_api.py)) now exposes an internal API endpoint
GET /internal/snapshotter/epochProcessingStatus
that returns a paginated response of the state transition status of snapshots against project IDs, upto 30 most recent epochs.Request:
Sample response:
Change logs
Added
Core API query endpoint
GET /internal/snapshotter/epochProcessingStatus
Record state transition of a snapshot at every step
Send health pings to onchain consensus reporting service every 2 seconds
pooler/snapshotter/process_hub_core.py
Lines 266 to 278 in bcc245d
pooler/snapshotter/process_hub_core.py
Lines 186 to 199 in bcc245d
pooler/snapshotter/process_hub_core.py
Lines 147 to 166 in bcc245d
Deployment Instructions
Pull the latest code and restart.
Ensure the issue reporting service URL in
config/settings.json
is set the base URL of the reporting service entry point of onchain-consensuspooler/config/settings.example.json
Lines 56 to 59 in bcc245d