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

use CryptoHash instead of ChainAndHeight in received_log #2264

Closed
wants to merge 2 commits into from

Conversation

ma2bd
Copy link
Contributor

@ma2bd ma2bd commented Jul 18, 2024

Motivation

  • Simplify code
  • Reduce storage
  • Avoid querying a ChainStateView in the local node (possibly more congested than storage) when we're downloading certificates
  • Make parallel downloads slightly easier in the future

Proposal

Use CryptoHash instead of ChainAndHeight in received_log.

Possible drawbacks:

  • Cleaning up certificates from client storage in the future is still possible but it will require an index of all executed certificates by hash. Such an index would be larger than maintaining the height of each chain.
  • The changes make it harder for a client to blacklist certain sender chains (i.e. refuse to synchronize their certificates and reject all their messages). This may require bringing back the chain ID of the senders in the received_log.

Test Plan

CI

Release Plan

  • Need to bump the major/minor version number in the next release of the crates.

@ma2bd ma2bd marked this pull request as draft July 18, 2024 11:13
@ma2bd ma2bd marked this pull request as ready for review July 18, 2024 13:18
@ma2bd ma2bd requested a review from afck July 18, 2024 13:23

let certificate = node.download_certificate(certificate_hash).await?;
for hash in response.info.requested_received_log {
let certificate = node.download_certificate(hash).await?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it be more efficient to query the local node first? Since this is based on the validator-specific tracker, wouldn't we download each certificate from every validator?

Copy link
Contributor Author

@ma2bd ma2bd Jul 18, 2024

Choose a reason for hiding this comment

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

This is the current behavior. I'll look into changing that in the next PR

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it? Aren't we checking that by making the local node query you are removing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh you're right! My bad. Let me maintain this behavior then.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@afck I updated the PR

@ma2bd ma2bd marked this pull request as draft July 18, 2024 18:25
@ma2bd ma2bd requested a review from afck July 21, 2024 21:11
@ma2bd ma2bd marked this pull request as ready for review July 21, 2024 21:12
@ma2bd ma2bd closed this Jul 21, 2024
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