Skip to content

fetch network info from the validation #329

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

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

Conversation

ckeshava
Copy link
Contributor

@ckeshava ckeshava commented Apr 3, 2025

High Level Overview of Change

The PR aims to reduce reading from the validators table. Since validation is the most recent source of truth, it must have the latest information about the network. If that field is not present, we can rely on the web-socket connection's metadata.

Context of Change

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Release

Before / After

Test Plan

Tests need to be added to verify the correctness. Furthermore, we need to measure the impact on the db performance with this change. This is planned for a future release.

@ckeshava ckeshava requested a review from Patel-Raj April 3, 2025 19:57
.first()
const validationNetwork =
validationNetworkDb?.networks ?? validationData.networks
const validationNetwork = validationData.networks ?? networks
Copy link
Contributor

Choose a reason for hiding this comment

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

As per #328 (comment)

I think we should fallback to the in-memory cache -> database to get the network as you suggested here #328 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that is also an acceptable solution. However, I'm wary of the larger untested code changes in that PR. I will also note one other (albeit rare) possibility:

The in-memory cache does not have any "invalidation scheme". The network corresponding to a validator's public_key could be changed after its admission into the in-memory cache. However, this change will not be registered until at least CM_INTERVAL. This would be a very rare occurence, but it is something we need to consider for the future.

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