As raised in #484 we need to do something about the duplication of state in the database. This RFC proposes to solve the problem by storing state efficiently before the last finalized checkpoint, in tables similar to those used in #484 (sequential DB keys, multiple values per key).
This is more of a quick idea dump before I start prototyping:
Store trait for the abstraction wrapper, so that the hot-cold DB can be swapped in and out with the existing DB implementation.A few issues require a bit more thought:
Sounds good! I've been thinking about this a bit and I'm totally on board!
Here's some points I've been considering:
block.slot along with block.tree_hash_root() (this is possible in block processing). In this case, we could (sometimes) know that the block is too old/young to be in the hot/cold database and do just one read.Yeah I'm on-board with all your points!
I think the configurable boundary point is a particularly good idea, I'll make sure the code is generic over that.
Being able to move this on the fly would be appealing but only if it's low-hanging fruit, IMO.
You mean you ask the node to switch more data into the hot/cold database while it's running? I can see how that would be useful, and doing the cold -> hot transfer could probably mirror the hot -> cold transfer quite easily.
You mean you ask the node to switch more data into the hot/cold database while it's running?
Correct! I didn't consider that we'd need to go cold -> hot. If that turns out to be complicated, I think just getting a non-dynamic system running would be a very significant improvement alone!
I'm prototyping, so far so good...
I just had a thought, when we start syncing from some mid-chain finalized state (e.g., weak subjectivity bounary) we'll want to be able to drop blocks/state directly into the freezer (without touching the hot db).
Yeah, with the way things are shaping up, I think syncing "middle out" from some finalized block should work well
Resolved by #508