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

Record state transition: snapshot submission to relayer #41

Merged
merged 2 commits into from
Aug 21, 2023

Conversation

anomit
Copy link
Member

@anomit anomit commented Aug 20, 2023

Fixes #40

Checklist

  • My branch is up-to-date with upstream/main branch.
  • Everything works and tested for major version of Python/NodeJS/Go and above.
  • I ran pre-commit checks against my changes.
  • I've written tests against my changes and all the current present tests are passing.

Current behaviour

As further detailed in the pooler issue PowerLoom/pooler#40, at present there is no information captured on the state transitions that a snapshot goes through from the point an epoch is released to it being finalized on the protocol state contract.

One of the important state transitions happens to be

  • RELAYER_SEND - Payload commit service has sent the snapshot to a transaction relayer to submit to the protocol state contract

This information is required to be captured by the payload commit service to offer a complete view of the state transition status of a snapshot.

New expected behaviour

The payload commit service records the responses returned from the relayer or the barebones EVM node to which it sends raw transactions.

go s.redisCache.UpdateEpochProcessingStatus(context.Background(), msg.ProjectID, msg.EpochID, "failed", err.Error())
go s.redisCache.AddSnapshotterStatusReport(context.Background(), msg.EpochID, msg.ProjectID, &datamodel.SnapshotterStatusReport{
SubmittedSnapshotCid: msg.SnapshotCID,
State: datamodel.MissedSnapshotSubmission,
Reason: "failed to submit snapshot to contract",
}, false)
return err
}
go s.redisCache.UpdateEpochProcessingStatus(context.Background(), msg.ProjectID, msg.EpochID, "success", "")

This information is stored against the Redis key REDIS_KEY_EPOCH_STATE_ID with the following data structure:

type SnapshotterStateUpdate struct {
Status string `json:"status"`
Error string `json:"error"`
Extra map[string]interface{} `json:"extra"`
Timestamp int64 `json:"timestamp"`
}

Change logs

Added

  • State transition information as detailed above on submission to relayer

Deployment Instructions

NA

Copy link
Member

@xadahiya xadahiya left a comment

Choose a reason for hiding this comment

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

Since these changes were deployed along with changes from PowerLoom/pooler#41 on a Staging instance and worked as expected without any issues, Approving!

@anomit anomit merged commit 935fd4d into main Aug 21, 2023
1 check 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.

Record status of snapshot submission to relayer
2 participants