Replies: 5 comments 4 replies
-
Multi-threadingComputers have a bunch of CPUs now. Even raspberry pis. I have a bunch of crummy old computers, some more than 10 years old, but none of them are single core. Also this code is in go, which is supposed to be good at multi-core stuff. So we should make things multi-core, right? However, in #225, we made the accumulator pretty much completely single threaded, and that made it faster. This was likely due to a bad implementation, making way too many goroutines. It feels like there should be a way to make the accumulator multi-threaded and faster. This also doesn't seem like it should be too hard, so that's something that might make an interesting project. |
Beta Was this translation helpful? Give feedback.
-
Sparse On-Disk ProofsRight now the bridge node creates a batch proof for every block, and keeps it stored on disk in a flat file. This is pretty fast: when a client requests a block, the server reads the whole thing off disk and sends that data straight to the network without even looking at it. The problem is the proofs are take up a lot of space, more than the actual blocks. (Something like 450GB on top of 380GB of block data) There are likely ways to reduce on-disk storage by keeping full proofs for some "key" blocks, and for other subsequent blocks only keeping partial proofs or "diff" proofs building off the key state. Ideally this would cut down on space without too much extra CPU or DoS risk. Another way to think about this: require that clients have a minimum TTL lookahead, and save proof blocks with that TTL. If the client doesn't need to download part of the proof, there's no need for the server to store it. |
Beta Was this translation helpful? Give feedback.
-
Clairvoyant memorable leavesCurrently the server have TTL values for each leaf, indicating how long (in blocks) a leaf will stay in the accumulator before being removed. The lookahead mechanism is helpful in reducing proof sizes by keeping only soon-to-be-removed leaves in memory, but it's definitely not optimal. For example, what if a client were using a 10 block lookahead, and there were a block where every output has a TTL of 11, then 10 empty blocks. The client would remember nothing, and require a proof for everything, with it's accumulator RAM cache completely empty for the entire duration. Since the entire schedule of insertions and deletions is known ahead of time, we can use a clairvoyant caching strategy to get optimal caching of leaves. Some notes: I tried this a while ago and it seemed to only have a 1 or 2% improvement in proof sizes. I think I just did it wrong though, and it's kind of bugged me since. It's gotta do a better job than lookahead, right? Also, if you want to get really fancy, this would only be optimal in terms of number of leaves cached; it doesn't know anything about adjacency of leaves, which is very important for proof sizes. It seems like that's also something that could be taken into account and optimized even further. |
Beta Was this translation helpful? Give feedback.
-
Leaf clusteringUtreexo inserts leaves into the accumulator once a block, and we do it as a batch of every TXO created in that block. Even though we're inserting many leaves at once, the order still matters (insertion is not commutative). The insertion ordering we use right now is just the block's ordering. So the coinbase outputs will be on the left, and block's last txo will be on the right. Miners usually order transactions within a block by fee rate, which doesn't have much to do with spending patterns. We could shuffle TXOs around any way we'd like, based on heuristics or TTL data, to get smaller proofs. The tricky part shuffling the insertions changes all subsequent proofs, so it must be deterministic and causal so that everyone can do it the same way. This complicated TTL based insertion clustering because we can't update it as new information becomes available without rebuilding proofs. There are a bunch of ways to potentially deal with this but they all seem a bit tricky. Also the encoding of the insertion permutation will take up some space as well (though not too much, and probably much less than the proof size savings). Overall it seems tricky / complex, but feels like it might result in much smaller proofs. |
Beta Was this translation helpful? Give feedback.
-
With at least one UROP joining, and hopefully others, here's a thread for research projects / ideas.
These are things that would improve utreexo, but that we're not quite sure about. And maybe they could be written up for academia points as well.
I'll put topics in separate replies here, just to try out the "discussions" feature.
Beta Was this translation helpful? Give feedback.
All reactions