-
Notifications
You must be signed in to change notification settings - Fork 219
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
fix: accumulated block data bitmap now contains current stxo indexes #3109
fix: accumulated block data bitmap now contains current stxo indexes #3109
Conversation
93601b1
to
1a040a4
Compare
1a040a4
to
ff6ee27
Compare
@@ -264,6 +264,9 @@ impl LMDBDatabase { | |||
UpdateDeletedBlockAccumulatedDataWithDiff { header_hash, deleted } => { | |||
self.update_deleted_block_accumulated_data_with_diff(&write_txn, header_hash, deleted)?; | |||
}, | |||
UpdateDeletedBitmap { deleted } => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like exposing this operation on its own. The deleted bitmap should only ever be updated as part of another operation, so that the database is alway consistent. Where is this operation called on it's own?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with that, but trying to avoid refactoring existing code too much. It's used in pruned mode where there are a number of operations that must be atomic to not break the database and could potentially be brought together into one operation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a comment there to discourage it's use
6f5dd66
to
ef69b32
Compare
Greatly reduces the amount of data stored per block by only storing the spent indexes at a specific height instead of the entire spent bitmap. The block chain database now stores a single full deleted bitmap at the tip. BREAKING CHANGE: Blockchain database format is not backward-compatible
ef69b32
to
d844043
Compare
PR queued successfully. Your position in queue is: 2 |
PR is on top of the queue now |
Prevent double spends from being added to the mempool. This bug was introduced by the blockchain deleted bitmap storage changes in tari-project#3109. A new block template contained already spent transactions which would then fail a double spend check in `calculate_mmr_roots`.
Prevent double spends from being added to the mempool. This bug was introduced by the blockchain deleted bitmap storage changes in tari-project#3109. A new block template contained already spent transactions which would then fail a double spend check in `calculate_mmr_roots`.
Prevent double spends from being added to the mempool. This bug was introduced by the blockchain deleted bitmap storage changes in tari-project#3109. A new block template contained already spent transactions which would then fail a double spend check in `calculate_mmr_roots`.
Prevent double spends from being added to the mempool. This bug was introduced by the blockchain deleted bitmap storage changes in tari-project#3109. A new block template contained already spent transactions which would then fail a double spend check in `calculate_mmr_roots`.
Prevent double spends from being added to the mempool. This bug was introduced by the blockchain deleted bitmap storage changes in tari-project#3109. A new block template contained already spent transactions which would then fail a double spend check in `calculate_mmr_roots`.
Prevent double spends from being added to the mempool. This bug was introduced by the blockchain deleted bitmap storage changes in tari-project#3109. A new block template contained already spent transactions which would then fail a double spend check in `calculate_mmr_roots`.
Prevent double spends from being added to the mempool. This bug was introduced by the blockchain deleted bitmap storage changes in tari-project#3109. A new block template contained already spent transactions which would then fail a double spend check in `calculate_mmr_roots`.
Prevent double spends from being added to the mempool. This bug was introduced by the blockchain deleted bitmap storage changes in tari-project#3109. A new block template contained already spent transactions which would then fail a double spend check in `calculate_mmr_roots`.
…3141) <!--- Provide a general summary of your changes in the Title above --> ## Description <!--- Describe your changes in detail --> The main change here is to check the tip height after retrieving the block template but before MMR roots are calculated. When mining quickly in cucumber tests, this race condition occurs. Previously, this would be ok, the miner would simply mine 1 behind the current tip height. But because we can no longer calculate MMRs prior to the tip, this MMR call (`get_new_block`) now returns an error, which fails cucumber. `get_new_block` now returns a `FailedPrecondition` GRPC error status in the event that the block template submitted is not for the current chain tip. This allows clients to more easily identify this case, typically by asking for a new template. This refactor was performed because the protocol was gaining too much complexity to exist in a single function. Some extra changes to get all cucumbers to pass: - Replace `--daemon` flags with `--non-interactive` - Used more 'tolerant' step for `As a user I want to change base node for a wallet` scenario ## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here. --> The `Verify all coinbases in hybrid mining are accounted for` cucumber test is flakey due to change in semantics for get_new_block since #3109. The possibility of this occurring with normal difficulties is usually tiny, but may be a symptom of a slow get_coinbase request. ## How Has This Been Tested? <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> Merge mined on local machine `Verify all coinbases in hybrid mining are accounted for` passes Suggest that we run tests with monero pool and nodejs pool ## Checklist: <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> * [x] I'm merging against the `development` branch. * [x] I have squashed my commits into a single commit.
Description
Greatly reduces the amount of data stored per block by only storing the
spent indexes at a specific height instead of the entire spent bitmap.
The block chain database now stores a single full deleted bitmap at the
tip.
Breaking changes:
Motivation and Context
Bytes of storage per block reduced. At height 8033, the savings are
130mb on the new database. As the STXO set increases, the size of
the deleted bitmap typically increases (depends on compressibility of the data
in the bitmap), previously resulting in many megabytes of data per block.
This is no longer the case.
As a result of only having the tip bitmap, we can only calculate the output_mr for the next block
from the tip. In practice this is all that is needed, however some unit tests needed to be updated.
How Has This Been Tested?
Checklist:
development
branch.BREAKING CHANGE: Blockchain Database (database must be resynced)