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

feat: optimize retrieval and caching #5

Open
wants to merge 27 commits into
base: main
Choose a base branch
from

Conversation

chetna-mittal
Copy link

@chetna-mittal chetna-mittal commented Jan 16, 2025

Fixes #4 and also includes previous changes from the dockerify branch

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.

Change logs

Added

  1. Improved Code Documentation

    • Added comments above functions for better understanding and clarity.
  2. Snapshotter State Contract Integration

    • Introduced the snapshotter state contract ABI and the respective generated contract.go file.
    • Implemented initialization functions for the snapshotter contract instance and ABI.
  3. Separation of Data Market States

    • Split static and dynamic data market states into separate functions for better modularity:
      • Dynamic States: DayCounter
      • Static States: epochsInADay, EPOCHSIZE, and SOURCECHAINBLOCKTIME
    • Dynamic states are polled at an interval defined by StatePollingInterval. Static states can also be polled at intervals if the PollingStaticStateVariables variable is set to true.
  4. Block Monitoring (Snapshotter State Events)

    • Processed blocks are checked for the allSnapshottersUpdated event. If present:
      • Extract the nodeID from the transaction input details.
      • Use the extracted nodeID to getSlotInfo and store it.
  5. Block Monitoring (Protocol State Events)

    • Processed blocks are checked for the EpochReleased event. If present:
      • Use the event details to get the epochID and store it.
  6. Configuration updates

    • The following environment variables have been added in config/settings.go:
      • DataMarketAddresses
      • DataMarketContractAddresses
      • BlockInterval - default set to 5 (used in seconds)
      • BlockOffset - default set to 2
      • StatePollingInterval - default set to 60 (used in seconds)
      • PollingStaticStateVariables

Changed

  • Changed alerts.go file from common package to reporting package within pkgs folder for better clarity

Removed

  • Redis keys which weren't being used in the codebase

Deployment Instructions

  • Pull the latest dockerify image

@chetna-mittal chetna-mittal self-assigned this Jan 16, 2025
@chetna-mittal chetna-mittal added the enhancement New feature or request label Jan 16, 2025
@chetna-mittal chetna-mittal marked this pull request as ready for review January 16, 2025 10:55
Copy link

@Seth-Schmidt Seth-Schmidt left a comment

Choose a reason for hiding this comment

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

Deployed and tested on staging. LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optimize retrieval and caching
3 participants