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(zebra-state): Send a reference to latest non-finalized state in TipAction::Reset #7927

Open
Tracked by #7728
arya2 opened this issue Nov 8, 2023 · 4 comments
Open
Tracked by #7728
Assignees
Labels
A-blockchain-scanner Area: Blockchain scanner of shielded transactions C-feature Category: New features C-security Category: Security issues

Comments

@arya2
Copy link
Contributor

arya2 commented Nov 8, 2023

Motivation

This is needed for the scanner task in zebra-scan (#7905) to get any blocks in the non-finalized portion of the best chain when there is a Reset action without repeated calls to the state service.

Possible Design

  • Add the latest_non_finalized_state watch channel receiver
  • Add a method on LatestTipChange that returns all the blocks in the latest non-finalized chain

This is acceptable because the worst-case scanning performance is 3 blocks per second, which means we can re-scan an entire non-finalized chain before the next block arrives. (Forks usually only happen every 300+ blocks.)

Alternative Solution

This solution is more complex than we need.

Too complicated

Add a method on LatestTipChange:

  • accepting a previous block hash
  • check if it matches any previous_block_hash in the non-finalized best chain (follow the old chain from the tip until reaching a common ancestor block)
  • return all blocks after and including the block with a matching previous_block_hash, or
  • return all blocks in the non-finalized best chain if it doesn't find the provided hash

Related Work

This ticket is required for:

@arya2 arya2 added S-needs-triage Status: A bug report needs triage P-Medium ⚡ C-feature Category: New features A-blockchain-scanner Area: Blockchain scanner of shielded transactions and removed S-needs-triage Status: A bug report needs triage labels Nov 8, 2023
@arya2 arya2 added the C-security Category: Security issues label Nov 9, 2023
@arya2 arya2 self-assigned this Nov 9, 2023
@teor2345
Copy link
Contributor

teor2345 commented Nov 10, 2023

I think we're missing the ticket that this ticket enables:

@arya2
Copy link
Contributor Author

arya2 commented Nov 10, 2023

I think we're missing the ticket that this ticket enables:

I was thinking this ticket could involve adding a method to be used instead of wait_for_tip_change() returning any new blocks on the chain that the receiver hasn't seen yet, so the task that scans new blocks as they come in would work for best chain changes too.

@teor2345
Copy link
Contributor

@mpguerra did we decide to move this issue to a later sprint?

@teor2345
Copy link
Contributor

teor2345 commented Dec 4, 2023

I updated this ticket based on the current scanning speed. We don't need a complicated solution because it is fast enough:
#7813 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-blockchain-scanner Area: Blockchain scanner of shielded transactions C-feature Category: New features C-security Category: Security issues
Projects
Status: Product Backlog
3 participants