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

Closed
Tracked by #7728
arya2 opened this issue Nov 8, 2023 · 6 comments
Closed
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 labels Nov 8, 2023
@mpguerra mpguerra added this to Zebra Nov 8, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New in Zebra Nov 8, 2023
@arya2 arya2 removed the S-needs-triage Status: A bug report needs triage label 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)

@arya2 arya2 self-assigned this Feb 12, 2024
@mpguerra mpguerra moved this from New to Sprint Backlog in Zebra Mar 6, 2024
@mpguerra mpguerra moved this from Sprint Backlog to Product Backlog in Zebra Mar 6, 2024
@arya2 arya2 moved this from Product Backlog to In progress in Zebra Jun 24, 2024
@mpguerra mpguerra moved this from In progress to Sprint Backlog in Zebra Jul 8, 2024
@arya2
Copy link
Contributor Author

arya2 commented Jul 14, 2024

@upbqdn @oxarbitrage I was wondering about adding a state request for getting the latest non-finalized state instead of adding it here, which makes more sense?

@mpguerra
Copy link
Contributor

We won't be doing any more work on the scanner

@mpguerra mpguerra closed this as not planned Won't fix, can't repro, duplicate, stale Oct 18, 2024
@github-project-automation github-project-automation bot moved this from Sprint Backlog to Done in Zebra Oct 18, 2024
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: Done
3 participants