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

Pass the finalized state to chain contextual validation #2503

Merged
merged 2 commits into from
Jul 19, 2021

Conversation

teor2345
Copy link
Contributor

Motivation

To check for missing UTXOs, we need to have the block, non-finalized chain, and finalized chain UTXOs.
The only place we have all the right data is just before we commit a block to a non-finalized chain.

So we need to pass the finalized state to this method.

Solution

  • Pass the finalized state to chain contextual validation
  • Add a new method for chain contextual validation, so we can handle errors correctly

This PR is part of #2231, but it doesn't close that ticket.

Review

This change will impact work that @conradoplg and @oxarbitrage are doing right now, so they should both review it.

We should try to get it merged soon, so we can avoid conflicts with that work.

Reviewer Checklist

  • Code implements Specs and Designs

This code has existing tests, and the finalized state will be tested as part of the transparent double spend checks in #2231.

This change is required to validate UTXOs against a forked chain.

Also abstract chain contextual validation into a new method.
@teor2345 teor2345 added A-rust Area: Updates to Rust code C-enhancement Category: This is an improvement P-Medium labels Jul 16, 2021
@teor2345 teor2345 self-assigned this Jul 16, 2021
Copy link
Collaborator

@conradoplg conradoplg left a comment

Choose a reason for hiding this comment

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

Great idea! Passing the whole finalized state and making both commit_block and commit_new_chain call the same function will make everything else much simpler.

@teor2345 teor2345 merged commit 684ce70 into main Jul 19, 2021
@teor2345 teor2345 deleted the finalized-state-in-chain-verification branch July 19, 2021 00:59
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.

2 participants