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

Implement best tip block hashes for ChainTip receivers #2677

Merged
merged 10 commits into from
Aug 27, 2021

Conversation

teor2345
Copy link
Contributor

@teor2345 teor2345 commented Aug 26, 2021

Motivation

In ticket #2639, we want to get block hashes, transaction information, and rollback information out of the state.

The ChainTip struct already gets block heights out of the state.

In this PR, I've added block hashes to the ChainTip information.

Solution

  • Always prefer the non-finalized tip in ChainTipSender
  • Update ChainTipSender with blocks, not heights
  • Provide a best tip hash in ChainTip receivers

Optimisation:

  • Skip finalized blocks once the non-finalized state is active

This PR does not close any tickets.

Review

@jvff can review this PR.

This PR is based on PR #2676.

Reviewer Checklist

  • Code implements Specs and Designs
  • Tests for Expected Behaviour
  • Tests for Errors

Follow Up Work

Do the rest of ticket #2639: transaction IDs, resets, initialization and missed update handling.

@teor2345 teor2345 added A-rust Area: Updates to Rust code C-enhancement Category: This is an improvement P-Medium labels Aug 26, 2021
@teor2345 teor2345 requested a review from jvff August 26, 2021 05:33
@teor2345 teor2345 self-assigned this Aug 26, 2021
@teor2345 teor2345 force-pushed the block-hash-chain-updates branch from 8783ec4 to 2483813 Compare August 26, 2021 05:36
@teor2345 teor2345 force-pushed the block-hash-chain-updates branch from 2483813 to 4661cd5 Compare August 27, 2021 00:00
@teor2345 teor2345 marked this pull request as ready for review August 27, 2021 00:14
@teor2345
Copy link
Contributor Author

@jvff this is ready for review now, I'll do the optimisations in a separate PR.

Base automatically changed from refactor-best-tip-height to main August 27, 2021 01:34
This significantly simplifies the internal implementation of ChainTipSender.

Also make the methods and types a bit more generic.
Also fix a bug where queued non-finalized blocks would clear the chain tip.
The finalized and non-finalized tips never update to `None`
once they have added at least one block.
jvff
jvff previously approved these changes Aug 27, 2021
@dconnolly dconnolly added this to the 2021 Sprint 17 milestone Aug 27, 2021
@dconnolly dconnolly enabled auto-merge (squash) August 27, 2021 18:57
@dconnolly dconnolly merged commit f9c90b3 into main Aug 27, 2021
@dconnolly dconnolly deleted the block-hash-chain-updates branch August 27, 2021 19:18
@mpguerra mpguerra removed this from the 2021 Sprint 17 milestone Aug 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rust Area: Updates to Rust code C-enhancement Category: This is an improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants