-
Notifications
You must be signed in to change notification settings - Fork 698
Ephemeral MARF #6365
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
base: develop
Are you sure you want to change the base?
Ephemeral MARF #6365
Conversation
…e on disk, and a RAM-backed MARF store which loads data from a read-only handle. Implement ClarityBlockStore for the ephemeral variant
/// Otherwise, use the disk-backed one. | ||
fn get_open_chain_tip_height(&mut self) -> u32 { | ||
if let EphemeralTip::RAM(..) = &self.open_tip { | ||
self.ephemeral_marf |
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 think this computes the RAM tip height and then discards it. Should we return that value + base_tip_height
(similar to get_current_block_height)?
I added an invariant prop_ephemeral_tip_height_matches_current
in the companion PR; it fails here and passes with this change: https://github.com/jcnelson/stacks-core/pull/1/files
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.
Yes, you are correct. Thanks!
fix: correct ephemeral open-tip height
Description
Implements #6350 by re-implementing
WritableMarfStore
as an enum of a persistent disk-backed variant (the one we currently have), and a new ephemeral variant in which writes are committed to a RAM-backed Sqlite store, and in which reads will hit both the in-RAM sqlite store and an internalReadOnlyMarfStore
handle. This feature will be used to allow the node to replay blocks without the possibility of committing them to disk.Applicable issues
Additional info (benefits, drawbacks, caveats)
A caveat: blocks produced with the ephemeral variant will not have the same state root hash as they would have had they been produced with the persistent variant. This is a consequence of the fact that the new block's MARF key/value pairs and side-storage live in a separate MARF, whose trie is not linked to the disk-backed parent trie. This is acceptable because the purpose of this PR is to allow the node to replay already-processed blocks in order to extract the transaction receipts. The node already knows the "true" state root hash.
This PR is a draft until it has enough test coverage.
Checklist
docs/rpc/openapi.yaml
andrpc-endpoints.md
for v2 endpoints,event-dispatcher.md
for new events)clarity-benchmarking
repobitcoin-tests.yml