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

Add utxo set soft validation. #113

Open
gdassori opened this issue May 25, 2021 · 3 comments
Open

Add utxo set soft validation. #113

gdassori opened this issue May 25, 2021 · 3 comments
Labels
development Normal development life cycle \ cleanups

Comments

@gdassori
Copy link
Member

Do checkpoints based soft validation (no scripts evaluation) and track the utxo set.

@gdassori gdassori added the development Normal development life cycle \ cleanups label May 29, 2021
@gdassori
Copy link
Member Author

gdassori commented Jun 13, 2021

  • Drop the existing UTXO storage.
  • Redesign the blockchain .repository.
  • Deserialize Blocks to the UTXO.
  • Design the UTXO repository w/ UTXO sharding.
  • Avoid validation before the checkpoints.
  • Save the UTXO status when saving a block.
  • Ensure a spent UTXO exists (soft validation) when saving a block.

@dakk
Copy link
Contributor

dakk commented Jun 14, 2021

A tiny hint for performance improvement: if the block is old in the chain, the "Ensure a spent UTXO exists (soft validation) when saving a block." can be neglected without loosing on security. Btw when saving a block you need to mark all spent utxo as spent

@gdassori
Copy link
Member Author

gdassori commented Jun 14, 2021

Let me see if I understand your point... are you suggesting to avoid the READ on the UTXO, and just hit a DELETE, basically to spend it, when the block height is, let's say... 100 blocks behind? (magic number).

So, when I receive a block with height = maxheight - 100:

for spent_utxo in block:
   repo.delete(spent_utxo)

else, with a recent block:

for spent_utxo in block:
   repo.ensure_utxo_exists(spent_utxo)
   repo.delete(spent_utxo)

Sort of? Sounds good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Normal development life cycle \ cleanups
Projects
None yet
Development

No branches or pull requests

2 participants