0xPolygonZero / zk_evm

Apache License 2.0
80 stars 36 forks source link

Add in trie dumping logic between txns #106

Closed BGluth closed 1 month ago

BGluth commented 6 months ago

I currently have some logic that I hacked in to dump all tries before and after txns. It's been useful enough times that I think we should probably get this back into main that is enabled with a prog arg or a feature flag.

Nashtare commented 6 months ago

Will you want to dump absolutely all tries or select them with some mechanism? IIRC this was taking a gigantic amount of space for real blocks, with all the storage tries stored to disk, so maybe there's a good middle ground that's still useful for debugging?

BGluth commented 6 months ago

That is a fair point, as this did produce ~1 mil files per block and take a large amount of GBs.

We can trim this safely easily though. Right now we're printing out all full tries every single txn, even if there's no trie mutation. While this can be useful (sometimes), we probably only need to do this at the start of the block. We could even maybe have a setting of how much we want to record about the tries (eg. only tries that mutated), as most of the time we only care about tries that change.

Nashtare commented 2 months ago

@BGluth Rather than dumping thousand of tries, I've proposed an alternative approach to automatically track discrepancies in state trie and possibly storage tries in #415. I think we have everything needed to do it, assuming we have some debug API of the decoder that exposes pre/post tries, as opposed to just pre tries as it currently does.

Nashtare commented 1 month ago

Closing as we will favor the approaches discussed in the debugging tools related discussion.